Ind*_*igo 13 ubuntu icons javafx-8
这有点奇怪,或者我的代码可能有问题.
我正在设置JavaFX应用程序ICON,它在Windows系统上非常清晰可见,但在Ubuntu上却没有.
在Windows上:

在Ubuntu上:

对此背后的原因有任何想法.
代码示例:
@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();
}
}
Run Code Online (Sandbox Code Playgroud)
对于寻求解决方案的人来说,这是JDK问题跟踪器中的一个未解决的问题.
根据JavaFX开发人员对类似问题的评论:
Glass/FX目前不支持GTK(RT-28202)上的全局菜单栏.因此,Glass不会设置任何应用程序范围的提示来指定应用程序名称或应用程序图标.桌面环境必须自己猜测它们(可能使用窗口的标题和图标).因此,"应用程序窗口"(上面的#1)应始终显示正确的标题是正确的,而其他3个位置可能会或可能不会根据时间显示正确的标题.在实施RT-28202之前,这不太可能改变.
在将JavaFX问题与JDK问题合并之前,RT-28202是上述链接问题的问题ID.
这个问题的选票非常少,因此没有引起太大兴趣.如果您已注册为贡献者,请随时为该问题投票.