mkpaz / atlantafx

Modern JavaFX CSS theme collection with additional controls.
https://mkpaz.github.io/atlantafx
MIT License
791 stars 64 forks source link

ControlsFX Notification doesn't work with AtlantaFX #94

Closed erwire closed 3 weeks ago

erwire commented 4 months ago

Hi!

During the development process, I noticed that after connecting AtlantaFX styles, Notification from the Controls FX packages did not work.

мая 02, 2024 2:11:12 AM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in module javafx.graphics@21.0.2 of loader 'app')' while converting value for '-fx-background-color' from rule '*.notification-bar>*.pane' in stylesheet jar:file:///C:/Users/jahng/.m2/repository/org/controlsfx/controlsfx/11.1.2/controlsfx-11.1.2.jar!/org/controlsfx/control/notificationpopup.css

Perhaps someone has already encountered this error, if you can tell me how to fix it (which style element to replace or correct), it would be great.

If you can tell me how to use the Notification provided in AtlantaFX without binding to any Root, and how it is presented in the ControlsFX package, I will be doubly grateful :)

mkpaz commented 3 weeks ago

ControlsFX uses Modena (JavaFX bundled theme) colour variables. These are not present in the AtlantaFX stylesheet, hence the error.

If you want to display desktop notifications like ControlsFX, you can refactor/adapt NotificationPopupHandler. It basically creates a Popup, puts a notification node into it and displays it using calculated screen coordinates depending on the selected position.