JDK-8029196 : Focus border of JButton.buttonType=roundRect is cut off
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7u45,8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-11-25
  • Updated: 2014-09-08
  • Resolved: 2014-04-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20 b11Fixed 9Fixed
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin Macintosh-7.local 13.0.2 Darwin Kernel Version 13.0.2: Sun Sep 29 19:38:57 PDT 2013; root:xnu-2422.75.4~1/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
The blue focus border of a "roundRect" JButton (as originally defined in https://developer.apple.com/library/mac/technotes/tn2007/tn2196.html) is cut off left and right in the current Oracle 1.7.0_45 release. Seems like something with the sizing is off.

I uploaded a screenshot to http://www.tagtraum.com/download/focus_border.png
(please remove this link after you attached the screenshot to the bug report)

This bug may be related to https://bugs.openjdk.java.net/browse/JDK-8000435

REGRESSION.  Last worked in version 7u45

ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a Swing UI with a button in JButton.buttonType = roundRect style. Make sure the button has the focus.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The blue focus border of the button should be intact.
ACTUAL -
The focus border is cut off left and right.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;

public class RoundedRectangleButton {

    public static void main(String[] args) {
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.getContentPane().setLayout(new BorderLayout());
        final JButton button = new JButton("FocusedButton");
        button.putClientProperty("JButton.buttonType", "roundRect");
        frame.add(button, BorderLayout.NORTH);
        frame.add(new JPanel(), BorderLayout.CENTER);
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                frame.setBounds(200, 200, 200, 70);
                frame.setVisible(true);
            }
        });
    }

}

---------- END SOURCE ----------
Comments
Just sample images with that bug reproduced.
03-06-2014

Release team: Approved for deferral.
06-12-2013

JDK8: SQE OK to defer
05-12-2013

8-defer-request: Not a regression from jdk7, not a jck. Small appearance problem.
05-12-2013

Swing_JButton/Automated/FocusedButton/FocusedButton.java
28-11-2013

Looks like the fix can be small and safe. I'll check that.
26-11-2013