Issue
Consider following code:
public class Main extends Application {
public static void main(String[] args) throws Exception {
launch( args );
}
@Override
public void start(Stage stage) throws Exception {
final BorderPane p = new BorderPane();
final Dialog dialog = new Dialog() { {
getDialogPane().setContent( new Button( "TEXT" ) );
} };
final Button bt = new Button( "LAUNCH" );
bt.setOnAction( e -> dialog.show() );
p.setCenter( bt );
stage.setScene( new Scene( p ));
stage.show();
}
}
Result is:
Code is simplified example.
Trouble is with the extra space at the bottom. Is there any way to remove it? Thank you.
Solution
You could do this:
@Override
public void start(Stage stage)
{
final BorderPane p = new BorderPane();
Stage dialog = new Stage();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setScene(new Scene(new Button("TEXT")));
final Button bt = new Button( "LAUNCH" );
bt.setOnAction( e -> dialog.show() );
p.setCenter( bt );
stage.setScene( new Scene( p ));
stage.show();
}
Answered By - SedJ601
Answer Checked By - Marie Seifert (JavaFixing Admin)