-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding styling to the menu-item #87
Comments
Don't believe that we can since the FXTrayIcon class basically augments the AWT TrayIcon without doing anything too fancy. I will look into the latest API for TrayIcon but if nothing has changed recently I'll probably close this issue with some comment along the lines of "unable to implement". |
Translate from Chinese to English: I think we can override the trayIcon.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
}
@Override
public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e) {
// popup menu trigger event
if (e.isPopupTrigger()) {
Platform.runLater(() -> {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("a fake popupmenu");
alert.setHeaderText(null);
alert.setContentText("add some menu item ...");
Stage stage = WindowsUtil.getStage(alert.getDialogPane());
stage.initStyle(StageStyle.UTILITY);
stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
System.out.println(STR."Stage focused is \{newValue}");
if (!newValue) {
alert.hide();
}
});
alert.show();
});
}
}
}); |
Something like this
The text was updated successfully, but these errors were encountered: