您好,我尝试覆盖普通 JButton 的设置。除背景颜色外,每个设置都在变化。我做错了什么?
public class Button extends JButton {
int red = 0;
int green = 175;
int blue = 206;
Color kleur = new Color(red, green, blue);
public Button(String text) {
super(text);
this.setBackground(kleur);
this.setFont(new Font("Tahoma", Font.PLAIN, 22));
this.setBorder(null);
this.setFocusPainted(false);
this.setContentAreaFilled(false);
}
}
最佳答案
问题是我没有将不透明设置为true。
this.setOpaque(true);
关于java - 覆盖按钮背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19663009/