Reputation: 763
Every window title bar of Mac OS has a full screen button at the top-right corner.Is there any way to hide this default full screen button of Mac OS in JavaFX?
Here is my code snippet:
public static void launchOkMessageBox(){
pane = new VBox();
scene = new Scene(pane,150,60, Color.GHOSTWHITE);
Label label = new Label("Hello Word");
Button okButton = new Button("Ok");
pane.getChildren().add(label);
pane.getChildren().add(okButton);
pane.setAlignment(Pos.CENTER);
pane.setSpacing(10);
messageBoxStage.setScene(scene);
messageBoxStage.setResizable(false);
messageBoxStage.sizeToScene();
messageBoxStage.show();
okButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
messageBoxStage.close();
}
});
}
Upvotes: 0
Views: 944
Reputation: 31
At least for the new dialog API it is sufficient have an owning Window
with modality set to APPLICATION_MODAL
(default):
Alert alert = new Alert();
alert.initOwner(mainStage);
Upvotes: 1
Reputation: 4602
One way to do it would be to set the StageStyle
to StageStyle.UTILITY
messageBoxStage.initStyle(StageStyle.UTILITY);
Upvotes: 0