Replies: 2 comments 4 replies
-
I would try FlatLaf - https://github.com/JFormDesigner/FlatLaf 😉 |
Beta Was this translation helpful? Give feedback.
1 reply
-
So, I tried out @DevCharly's suggestion and it does seem to work. I have my code like so: public static void main(String[] args) {
// Set the look and feel
FlatCarbonIJTheme.install();
final OsThemeDetector detector = OsThemeDetector.getDetector();
detector.registerListener(isDark -> {
if (isDark) {
// The OS switched to a dark theme
FlatCarbonIJTheme.install();
FlatCarbonIJTheme.updateUI();
} else {
// The OS switched to a light theme
FlatCyanLightIJTheme.install();
FlatCyanLightIJTheme.updateUI();
}
});
// Create the frame
ArtDeptNew frame = new ArtDeptNew();
[...]
} I hope this is the 'preferred' way of doing it. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am very much looking forward to using this library to add a dark mode to my little project. It seems to take care of the "detect if the OS is in Dark Mode" portion, but now I need to know how to change my Java app to a dark theme to follow along with the OS.
What is the preferred way of changing a Java Swing app's theme? Will I need a separate library? Is there a collection of different themes available somewhere from which I can choose an appropriate dark theme or will it be set automatically by the OS? I'm still quite new, as you can tell, and could use some direction.
Beta Was this translation helpful? Give feedback.
All reactions