I am currently exploring the new features from Java JDK 8u40, and I must say I really like the build-in dialog class. In comparison to ControlsFX, there is no background effect when the dialog is openend (ControlsFX made the background appear darker). I also would like to do this with the new dialog class in JavaFX. I am using the following code:
TextInputDialog dialog = new TextInputDialog();
dialog.initOwner(null);
dialog.initStyle(StageStyle.UNDECORATED);
dialog.setHeaderText(“Please fill in a new number“);
dialog.setContentText(“New number:”);
//Check if the optional is filled in
Optional<String> newAmount = dialog.showAndWait();
if (result.isPresent()){
System.out.println(“New number: " + result.get());
}
I could not find any helpful parts in the dialog class. I tried this code, but it is a bit hacky, and a little bit slow:
myMainFlowPane.setOpacity(0.5);
// ..... dialog code ..... //
myMainFlowPane.setOpacity(1.0);
You should say there has to be a build-in method for this. Any of you know how to do this?
Any help is greatly appreciated!