0
  1. This will change all the JRadioButton's checkmark color.

    UIManager.put( "CheckBox.icon.checkmarkColor", Color.red );
    LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
    try {
        UIManager.setLookAndFeel( lookAndFeel );
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    }
    updateUI();
    
  2. And then I want to only change radiobutton1's color while I click another button. But it does not work.

    radiobutton1.putClientProperty( "CheckBox.icon.checkmarkColor",Color.yellow);
    

enter image description here

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Alpha
  • 1
  • 1

1 Answers1

0

Use "style" can do this.

radiobutton1.putClientProperty( FlatClientProperties.STYLE,"icon.checkmarkColor:#ffff66");

This can change only radiobutton1's "icon.checkmarkColor".

Alpha
  • 1
  • 1