-
Bug
-
Resolution: Unresolved
-
P3
-
11, 16, 17
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Windows 10
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Labels that use HTML are wrapping before emoticons, while non-HTML label don't. Like the title mentions, this only happens if zoom is enabled in Windows. It doesn't seem to matter what zoom level is used. In our case we used 125% though.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
0. Set Windows system zoom to 125%
1. Create a JLabel
2. Set the following text "<html>TEXT 🦁</html>"
3. Put the JLabel into a JFrame
4. Show the frame
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
None of the labels should line wrap, since there's enough horizontal space availale.
ACTUAL -
The labels that wrap their content in <html></html> wrap without the need to do so.
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
public class Buggy
{
public static void main( final String[] args )
{
final JFrame frame = new JFrame();
final JLabel labelA = new JLabel( "<html>HTML Emoji character 🦁</html>" );
final JLabel labelB = new JLabel( "<html>HTML Emoji escape sequence 🦁</html>" );
final JLabel labelC = new JLabel( "Emoji character 🦁" );
//To show there's enough space inside the label and show where each label starts and ends.
labelA.setOpaque( true );
labelA.setBackground( Color.YELLOW );
labelB.setOpaque( true );
labelB.setBackground( Color.GREEN );
labelC.setOpaque( true );
labelC.setBackground( Color.RED );
frame.setLayout( new GridLayout( 3, 1 ) );
frame.add( labelA );
frame.add( labelB );
frame.add( labelC );
frame.setSize( 400, 300 );
frame.setLocationRelativeTo( null );
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
frame.setVisible( true );
}
}
---------- END SOURCE ----------
FREQUENCY : always
Windows 10
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Labels that use HTML are wrapping before emoticons, while non-HTML label don't. Like the title mentions, this only happens if zoom is enabled in Windows. It doesn't seem to matter what zoom level is used. In our case we used 125% though.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
0. Set Windows system zoom to 125%
1. Create a JLabel
2. Set the following text "<html>TEXT 🦁</html>"
3. Put the JLabel into a JFrame
4. Show the frame
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
None of the labels should line wrap, since there's enough horizontal space availale.
ACTUAL -
The labels that wrap their content in <html></html> wrap without the need to do so.
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
public class Buggy
{
public static void main( final String[] args )
{
final JFrame frame = new JFrame();
final JLabel labelA = new JLabel( "<html>HTML Emoji character 🦁</html>" );
final JLabel labelB = new JLabel( "<html>HTML Emoji escape sequence 🦁</html>" );
final JLabel labelC = new JLabel( "Emoji character 🦁" );
//To show there's enough space inside the label and show where each label starts and ends.
labelA.setOpaque( true );
labelA.setBackground( Color.YELLOW );
labelB.setOpaque( true );
labelB.setBackground( Color.GREEN );
labelC.setOpaque( true );
labelC.setBackground( Color.RED );
frame.setLayout( new GridLayout( 3, 1 ) );
frame.add( labelA );
frame.add( labelB );
frame.add( labelC );
frame.setSize( 400, 300 );
frame.setLocationRelativeTo( null );
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
frame.setVisible( true );
}
}
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8278957 JLabel with HTML breaks text incorrectly on High Resolution Display
- Closed
- relates to
-
JDK-8194161 Line wrapping of JTextPane incorrect
- Closed