Skip to content
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

click event on notification #12

Open
luckybox7 opened this issue Apr 19, 2017 · 2 comments
Open

click event on notification #12

luckybox7 opened this issue Apr 19, 2017 · 2 comments

Comments

@luckybox7
Copy link

Is it possible to set click event on notification??

@tayeh
Copy link

tayeh commented Jun 24, 2017

+1

@kinsleykajiva
Copy link

kinsleykajiva commented Apr 1, 2018

Hey this what i have done to add the click event, i added onMessageClicked() method in the TrayNotification Class in the tray folders:

public void onMessageClicked (EventHandler<? super MouseEvent> event){
        rootNode.setOnMouseClicked( event );

    }

How to use it :

String title = "Congratulations sir";
                        String message = "You've successfully created your first Tray Notification";
                        NotificationType notification = NotificationType.SUCCESS;

                        TrayNotification tray = new TrayNotification();
                        tray.setTitle(title);
                        tray.setMessage(message);
                        tray.setNotificationType(notification);
                        //tray.showAndDismiss( Duration.millis( 5000 ) );
                        tray.showAndWait();
                        tray.onMessageClicked( v->
                            System.out.println( "|onMessageClicked|" )

                        );

try it out and see if it works for you, by the way, i am using this on JDK 10, but i doubt if you will have issues with jdk versions, so I thought to mention this just in case ey, good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants