FULL PRODUCT VERSION :
java version "1.8.0_20-ea"
Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b05)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
MacOS X Version 10.9.4
Darwin 192.168.1.3 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
When JTextField is used with the "JTextField.variant" client property set to "search" on the MacOS Aqua L&F, the text field's blue focus ring is clipped by one or two pixels on all four sides.
The bug is a variation of bug #5046173 mentioned in http://www.filibeto.org/unix/macos/lib/dev/releasenotes/Java/JavaLeopardRN/JavaLeopardRN.pdf , "JTextFields had clipped focus rings". The aforementioned bug was partially resolved, but is still present in cases where the JTextField has the "JTextField.variant" client property set to "search".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JFrame with a JTextField in the BorderLayout.NORTH position. Call putClientProperty("JTextField.variant", "search") on the JTextField. Show the JFrame on MacOS with the default Aqua L&F, and click to give the JTextField focus. If you look closely, the blue focus ring around the text field is clipped by one or two pixels on all four sides.
See the minimal example code provided in the "source code for an executable test case" field.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The focus ring of the JTextField in search mode should not be clipped.
ACTUAL -
The focus ring of the JTextField in search mode was clipped by one or two pixels on all four sides.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class FocusRingBugFrame extends javax.swing.JFrame {
private final javax.swing.JTextField textField;
public FocusRingBugFrame() {
textField = new javax.swing.JTextField();
textField.putClientProperty("JTextField.variant", "search");
getContentPane().add(textField, java.awt.BorderLayout.NORTH);
pack();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new FocusRingBugFrame().setVisible(true);
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround found. I tried forcing a different preferred size for the JTextField with setPreferredSize, and putting the JTextField in different layouts, but it always remains clipped.