-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
10.0.2, 13
-
x86_64
-
windows_10
A DESCRIPTION OF THE PROBLEM :
The text of a JToggleButton using certain characters such as lowercase "x" will be truncated when displayed using the Windows look and feel. This worked in JDK 8, 9, 10.0.1 and stopped working in JDK 10.0.2. It remains broken in JDK 11 and later (including JDK 13 EA).
REGRESSION : Last worked in version 10.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the provide `WindowsToggleButtonTextTruncation` class.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A toggle button and a regular button both displaying the label "x"
ACTUAL -
A toggle button displaying an elipsis ("...") and a regular button displaying "x"
---------- BEGIN SOURCE ----------
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.WindowConstants;
public class WindowsToggleButtonTextTruncation {
private static final String LABEL = "x";
public static void main(String... args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
Logger.getLogger(WindowsToggleButtonTextTruncation.class.getName()).log(Level.SEVERE, null, ex);
}
JFrame frame = new JFrame("Toggle Button Text Truncation");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.PAGE_AXIS));
frame.add(new JToggleButton(LABEL)); // Toggle button label will be truncated
frame.add(new JButton(LABEL));
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Manually adjust the preferred size
FREQUENCY : always
The text of a JToggleButton using certain characters such as lowercase "x" will be truncated when displayed using the Windows look and feel. This worked in JDK 8, 9, 10.0.1 and stopped working in JDK 10.0.2. It remains broken in JDK 11 and later (including JDK 13 EA).
REGRESSION : Last worked in version 10.0.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the provide `WindowsToggleButtonTextTruncation` class.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A toggle button and a regular button both displaying the label "x"
ACTUAL -
A toggle button displaying an elipsis ("...") and a regular button displaying "x"
---------- BEGIN SOURCE ----------
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JToggleButton;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.WindowConstants;
public class WindowsToggleButtonTextTruncation {
private static final String LABEL = "x";
public static void main(String... args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
Logger.getLogger(WindowsToggleButtonTextTruncation.class.getName()).log(Level.SEVERE, null, ex);
}
JFrame frame = new JFrame("Toggle Button Text Truncation");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.PAGE_AXIS));
frame.add(new JToggleButton(LABEL)); // Toggle button label will be truncated
frame.add(new JButton(LABEL));
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Manually adjust the preferred size
FREQUENCY : always
- duplicates
-
JDK-8227570 Additional information to JDK-8226215
- Closed
- relates to
-
JDK-8227486 Additional information to JDK-8226215
- Closed
-
JDK-8228763 Improper kerning adding extra whitespace in some text
- Closed