如下所示,在“继续”按钮中,“继续”一词周围有一个边框。有关如何解决此问题的任何建议或对导致此问题的原因有任何解释吗?
this.continueButton = new JButton("Continue");
this.continueButton.setBounds(135, 258, 95, 25);
this.continueButton.setForeground(new Color(17,138,203));
this.continueButton.setBackground(Color.WHITE);
this.continueButton.addMouseListener(mmlc);
this.continueButton.addActionListener(this);
add(this.continueButton);
this.exitButton = new JButton("Exit");
this.exitButton.setBackground(Color.WHITE);
this.exitButton.setBounds(242, 258, 95, 25);
this.exitButton.setForeground(new Color(17,138,203));
this.exitButton.addMouseListener(mmlc);
this.exitButton.addActionListener(this);
add(this.exitButton);`
最佳答案
看起来按钮默认处于焦点状态,您可以通过jButton.setFocus Painted(false);禁用焦点方 block 绘制
关于java - 我的 JButton 在 Java 中的外观存在问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34394832/