CSS problem on JavaFX e4 app [message #1823015] |
Wed, 18 March 2020 03:41  |
Eclipse User |
|
|
|
Hi,
I write again, this time about applying CSS to an Eclipse JavaFX e4 project.
Following Tom's blog, in particular https://tomsondev.bestsolution.at/2015/01/23/efxclipse-1-2-0-themes-are-osgi-services/, I understood that CSS is linked to the concept of theme.
The structure of my project is generated using Scene Builder, then generating its FXML.
So if I change the default.css, for example going to set the color for a button, this change is not applied.
Is there any guide I can follow?
Do I have to link the .css or the theme to SceneBuilder?
I probably didn't quite understand the path to take between the application, Scene Builder and the theme.
Thanks for the reply.
|
|
|
|
|
|
|
|
|
|
|
Re: CSS problem on JavaFX e4 app [message #1823788 is a reply to message #1823771] |
Thu, 02 April 2020 02:53   |
Eclipse User |
|
|
|
I have created two sheets of css, Day.css and Night.css "which I wish were related to two themes.
Then, I have created two classes, DayTheme and NightTheme, classes that extends AbstractTheme (implemented as above for the DefaultTheme).
Therefore, I created two OSGI services, one for each class, theme-day.xml and theme-night.xml.
theme-day.xml is associated with the DayTheme class and the same goes for Night.
Then the two .xml services are registered in the MANIFEST.
You asked me: where's your service implement Stylesheet?
What do you mean?
Then, I implemented two functions:
public static void switchTheme(String themeID) {
themeManager.setCurrentThemeId(themeID);
}
public static Theme getTheme() {
return themeManager.getCurrentTheme();
}
and I verified that the theme is actually associated, since by getting the current theme, it is returned.
But the css (ie the theme) is not associated with the context.
It is as if the theme does not register the css.
What am I missing?
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05261 seconds