Closed RealThanhpv closed 1 year ago
Thanks! It's a Sampler issue. I think custom pseudo class that changes accent color is added to the main stage root container, so modal stages do not inherit its state.
I think any scene can be registered to the ThemeManager so that It styles multiple scene as an application may have multiple scenes. And also a public method to style a scene without being registered. I think it is good to make it as a public util.
Theme API supposed to be a temporary solution as I expected this PR (https://github.com/openjdk/jfx/pull/511) should be delivered by JFX20. But considering this very long discussion and the last update I suppose it won't be merged this year. As much as I don't like the whole over-engineering around this, I don't want to re-invent the wheel too, because any API I'd publish will obsolete immediately after core API changes.
@mkpaz is right. Theming a JavaFX app is quite cumbersome right now, would be great to have that proposed API The easiest fix I found while tinkering with the sampler is to activate the pseudo class directly on the Alert pane, fortunately it's easy to retrieve the current color from the ThemeManager
However, there's one thing I'm missing, I'm trying to figure out how are you styling the dialogs. I tried commenting the Application.setUserAgentStylesheet(Objects.requireNonNull(theme.getUserAgentStylesheet()));
line in the ThemeManger, but Alerts will still be styled. So, how are you doing it? Alerts/Dialogs/Popups and such are separate Scenes, they do not inherit stylesheets from the main Window, do they?
If this is true then, to style a Scene a solution like the one suggested above would be required, the Theme should be added on any separate Window/Scene. This is not desirable tough as it could be quite heavy on performance
What am I missing?
This is really great lib.
Customize accent color is not applied to dialog scene. I think it should, right?