It is a bit weird or maybe there is something wrong with my code.
I am setting JavaFX application ICON which is very well visible on Windows system but not on Ubuntu.
On Windows:
On Ubuntu:
Any idea about the reason behind this.
Code Sample:
@Override
public void start(Stage stage) throws Exception {
try {
setUserAgentStylesheet(STYLESHEET_MODENA);
FXMLLoader loader = new FXMLLoader();
Parent root = (Parent) loader.load(getClass().getResourceAsStream("ui/ParentWindow.fxml"));
final ParentWindowController controller = (ParentWindowController) loader.getController();
stage.addEventHandler(WindowEvent.WINDOW_SHOWN, controller::handleWindowShownEvent);
stage.addEventHandler(WindowEvent.WINDOW_SHOWING, controller::handleWindowShowingEvent);
stage.addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, controller::handleWindowClosingRequestedEvent);
Scene scene = new Scene(root);
scene.getStylesheets().setAll(
getClass().getResource("ui/css/ParentWindow.css").toExternalForm()
);
stage.setScene(scene);
stage.initStyle(StageStyle.UNIFIED);
stage.setResizable(false);
stage.toFront();
stage.setTitle("Simple JavaFX Tool");
stage.getIcons().add(new Image(getClass().getResourceAsStream("resources/images/icon.jpg")));
stage.show();
} catch (IOException iOException) {
iOException.printStackTrace();
}
}