Vatsal Doshi
Vatsal Doshi

Reputation: 21

Change Color of Disabled GUI Components in Java

Guys I want to change the appearance of a disabled JRadioButton, JCheckBox

This code works well for ComboBox but when replaced by CheckBox or RadioButton no effect.

    UIManager.put("ComboBox.disabledForeground", Color.BLACK);

Also i want the Button to be non-editable. So dont suggest options like

    RadioButton.setEnabled(false);

What I get vs What i Want.

Upvotes: 2

Views: 1869

Answers (1)

camickr
camickr

Reputation: 324147

This code works well for ComboBox but when replaced by CheckBox or RadioButton no effect.

UIManager.put("ComboBox.disabledForeground", Color.BLACK);

For a JCheckBox and JRadioButton you should be able to use:

UIManager.put("CheckBox.disabledText", Color.BLACK);
UIManager.put("RadioButton.disabledText", Color.BLACK);

Check out UIManager Defaults for all the default values of the UIManager.

Upvotes: 2

Related Questions