0

Is it possible to change jbutton color after applying the system default L&F? I've used this code in my main method before applying color changes:

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
       | IllegalAccessException | UnsupportedLookAndFeelException e1) {
    e1.printStackTrace();
}

Unfortunately, the button appears as the default grey color, even after specifically setting the background color in this class:

public class ProperButton extends JButton {
    private static final long serialVersionUID = -5613675445790470261L;

     public ProperButton(String label) {
         super(label);
         this.setBackground(new Color(111, 111, 111));
     }

}
StanislavL
  • 56,971
  • 9
  • 68
  • 98
Dylan Katz
  • 194
  • 2
  • 14

0 Answers0