0

[Edit] here is an exemple of use of the notification popup I'm talking about:

Notifications.create().title(...).text(...).hideAfter(Duration).show();

in this case the notification popup follow the modena style (a little bit gray)

if we add dark style like this:

Notifications.create().darkStyle().title(...).text(...).hideAfter(Duration).show();

It's shown with dark color

So I just want to know if there is a way to change these default style, I already know about the notification pane and I am not talking about it.

So please I made my homework and did some research ... I found nothing that's why I here to find help

ItachiUchiha
  • 36,135
  • 10
  • 122
  • 176
Moussa
  • 461
  • 4
  • 14

2 Answers2

2

Take a look at the documentation: https://controlsfx.bitbucket.io/org/controlsfx/control/NotificationPane.html

You can take a look at the CSS file for the notification pane here: /org/controlsfx/control/notificationpane.css

Now you can use the CSS classes in your own stylesheet.

Phil
  • 306
  • 1
  • 8
  • Thanks for your answer, but I was'nt talking about the notification pane itself but the notification popup who is shown inside our application depending on a position https://controlsfx.bitbucket.io/org/controlsfx/control/Notifications.html – Moussa Jun 23 '17 at 11:10
  • It's the same approach. In the same package you will find the styleclass for your Notification class: notificationpopup.css – Phil Jun 23 '17 at 11:55
  • Thanks Phil, I got it – Moussa Jun 23 '17 at 13:13
1

Here is how I did:

  • I added a new css file named notificationpopup.css as Phil mentionned (thanks to him)

  • inside that file i maked changes I added the css file to my primaryStage

  • set the owner of my notification popup to this stage And it works well now !

String css = this.getClass().getResource("/views/notificationpopup.css").toExternalForm();
//as my css are in a views package

primaryStage.getScene().getStylesheets().add(css);
Notifications.create().owner(primaryStage).text("my message").hideAfter(new Duration(2000)).showInformation();

If you want an example of the notificationpopup.css to make your own visit the repository of controlfx

Thanks to Phil and the community for the help

Moussa
  • 461
  • 4
  • 14