'Java Swing change colorscheme

I am currently developing a larger application and I want to be able to use a dark mode.

I am using the Look and Feel: UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

I do not want to use the Nimbus look and feel because i think it does not look good. Can i just change the default colors of this look and feel?

I have already tried around a lot by doing

Color control = UIManager.getColor("control");
Color info = UIManager.getColor("info");
Color text = UIManager.getColor("text");
UIManager.put("control", control);
UIManager.put("info", info);
UIManager.put("text", text);
SwingUtilities.updateComponentTreeUI(textEditor.getFrame());

But that didn`t work either.

I hope you can help me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source