gpt4 book ai didi

java - 我的 JButton 在 Java 中的外观存在问题

转载 作者:行者123 更新时间:2023-12-01 10:41:23 26 4
gpt4 key购买 nike

如下所示,在“继续”按钮中,“继续”一词周围有一个边框。有关如何解决此问题的任何建议或对导致此问题的原因有任何解释吗?

enter image description here

    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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com