问题
[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
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/44710401/is-there-a-way-to-change-the-built-in-controlfx-notification-popup-color