答案 0 :(得分:4)
没有为JavaFX定义带有徽章的图标的特定方法。但是,您可以根据是否收到通知来更改应用程序图标:
// define two (or more) different icons
Image iconWithNoNotifications = new Image(this.getClass().getResourceAsStream("app_icon.png"));
Image iconWithNotifications = new Image(this.getClass().getResourceAsStream("app_icon_with_notification.png"));
// change the icon when the notifications count changes
primaryStage.getIcons().add(nNotifications == 0 ? iconWithNoNotifications : iconWithNotifications);