Вопрос

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?

Это было полезно?

Решение

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);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top