Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javafx TextInputDialog Disable ok button

Tags:

java

javafx

I am using the JDK8u45 and I am trying to use the text input dialog but is there a way to disable the ok button until I enable it? I checked the java docs and did not see a disable feature. Is there another way to do this in java 8 if this does not work?

like image 388
Ericode Avatar asked Jul 10 '15 22:07

Ericode


1 Answers

Lookup the button and invoke setDisable on it.

TextInputDialog dialog = new TextInputDialog();
dialog.getDialogPane().lookupButton(ButtonType.OK).setDisable(true);

disable is a property, so you could bind the value to some condition if you wish (rather than explicitly calling setters to disable and re-enable it).

like image 167
jewelsea Avatar answered Sep 22 '22 17:09

jewelsea