Reputation: 2238
I am creating a sample code to show the Stage designed in Javafx, It should not have Minimize and Maximize Button only Close ('X') button required.
For that we are using following code.
Stage stage = new Stage();
// Here we have load it using JFXML
stage.initModality(Modality.WINDOW_MODAL);
stage.initStyle(StageStyle.UTILITY);
stage.setResizable(true);
if (title != null && !title.trim().isEmpty()) {
stage.setTitle(title);
}
stage.setWidth(w);
stage.setHeight(h);
stage.getIcons().add(new Image(Dialog.class.getResourceAsStream("/image/myicon.png")));
stage.showAndWait();
Now the icon I set on the stage is not visible.
What I am missing ?
Upvotes: 2
Views: 837
Reputation: 4745
I assume Windows as the OS (in MacOSX the icon is shown). Under Windows, StageStyle.UTILITY
leads to using WS_EX_TOOLWINDOW
in which case the icon is not shown. You probably need to use another StageStyle.
Upvotes: 1