Pergunta

How to set the disabled text color for every JLabel in my program. It is not in the docs . Is there any way to set the disabled foreground color for it?

Foi útil?

Solução

I got it. Foreground can be set using UI Defaults.

// Use the key, Label.disabledForeground
UIManager.put("Label.disabledForeground",Color.RED);

JLabel l=new JLabel("Label Disabled");
l.setEnabled(false);
// You get a red foreground

For NimbusLookAndFeel

UIManager.put("Label[Disabled].textForeground",Color.RED);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top