-
Notifications
You must be signed in to change notification settings - Fork 1
ThemeManager Class
Natalie L edited this page Dec 5, 2024
·
1 revision
The ThemeManager class is part of the services package
(package org.example.globalgoodsindex.services). It manages the
application's UI themes by applying and saving user preferences. It uses AtlantFX
themes (e.g., Nord, Primer) to
provide
a modern, visually appealing interface.
The class registers themes and allows switching between them based on the user's choice.
Registers the available themes and their associated stylesheets.
- Maps theme names (e.g., PrimerLight, NordDark) to the corresponding stylesheets provided by AtlantFX .
- This method is called when the
ThemeManageris initialized to make sure the themes are available for application.
ThemeManager themeManager = new ThemeManager(preferencesManager);Applies the selected theme to the application interface.
- Retrieves the stylesheet for the selected theme from the
themeStylesheetsmap and sets it as the application's user agent stylesheet. - Saves the selected theme using the
preferencesManagerfor future use.
themeManager.applyTheme("NordDark");Fetches the saved theme from the user's preferences.
- Retrieves the theme previously saved by the
preferencesManager.
String savedTheme = themeManager.getSavedTheme();