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

标签 java swing user-interface jbutton

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

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/

相关文章:

java - 为什么我们应该使用 wiremock 而不是 Mockito

java - 应用程序错误地创建了多个 CDI-Bean

java - 如何为一个窗口编写一个退出程序,而不会关闭其他打开的窗口?

java - 用于 SWT/AWT 的图形可视化库

c# - 堆叠和延迟多个 UI 更改通知

java - 如何从 TypeMirror 创建实例

语言规范中的Java静态初始化线程安全保证

java - 我如何计算 JTextArea 中的行数?

git - 在 git 命令行中禁用进度指示

c - 使用 GUI 自动填充数组