How can I get the color of the button text using LaF?

In my Java application, I have to customize the control, and for this I need to use the same font colors as JButton. (Enabled and disabled) I do not want to hard code them, because the user can change the shell of the substance at run time.

I know ColorSchemes, but I'm not sure how to act as soon as I have the color scheme of the current skin. In addition, the documentation on substances speaks of creating my own color scheme, but I just can’t understand how to get a certain color.

+3
source share
2 answers

OK, finally, I realized:

. Substance , getCurrentSkin.

SubstanceColorScheme s = SubstanceLookAndFeel
        .getCurrentSkin(myComponent)
        .getEnabledColorScheme(
                SubstanceLookAndFeel.getDecorationType(myComponent)
         );

: getDisabledColorScheme, getActiveColorScheme getBackgroundColorScheme.

s.getForegroundColor SubstanceColorUtilities.

+2

Source: https://habr.com/ru/post/1746322/


All Articles