Question

I've got a little issue with creating an custom Theme for Metal LaF.

After reading the one or other tutorial, I was able to create a class, overriding the primary and secondary color values 1-3.
Most of the Gui works well this way.

Only Labels and Buttons still had the font color set to black, which I wasn't able to change this way, as well as filled Progressbars and Textfield Background, which are white. As for the Labels I found the possibility, to override "getSystemTextColor()".

I read about some constants "black" and "white" that are used for the Metal LaF, but wasn't able to figure out how to override them... Might that be the way?

The hard way I also could change each Buttons foreground manually, but I guess there's a more comfortable way.

So, anybody who is more familiar with the LaF's than me: Is there hope to replace:
-Button Font color
-filled Progressbar Font color -Textfield Background color

Was it helpful?

Solution

For this purposes you can use UIManager , it contains Constants for colors of Components. For example:

  UIManager.put("Button.foreground", Color.RED);
  UIManager.put("TextField.background", Color.BLACK);
  UIManager.put("ProgressBar.selectionBackground", Color.WHITE);

All Constants you can find in google

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top