0

应用系统默认 L&F 后是否可以更改 jbutton 颜色?在应用颜色更改之前,我在我的主要方法中使用了此代码:

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

不幸的是,该按钮显示为默认灰色,即使在此类中专门设置了背景颜色:

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

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

}
4

0 回答 0