Issue
How can I set JavaFX alert height in which dialog's contentText
is null
? I made an alert and set contentText
as null, but dialog's contentText
field's height does not became smaller. How can I make contentText
field's height as minimum?
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("title");
alert.setHeaderText("I want to make dialog without contenttext");
alert.setContentText(null); //this is null but this field is still remain
I just tried like this.
alert.getDialogPane().setMaxHeight(10); //does not work.
Solution
Using this method you can customize the size of the alert.
alert.getDialogPane().setMaxSize(2,2);
Default Preview
Preview after the code
Answered By - Jamith NImantha