-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
None
-
6u10
-
x86
-
linux_ubuntu
Font of JLabel significantly depends on the look-and-feel used on some Ubuntu/KDE systems.
Metal and Nimbus is fine but when using GTK L&F the font size increase more that by 50% and overall design flaws.
It happens with any JDK.
Originally reporeted in NetBeans IssueZilla agains NetBeans Installer:
http://www.netbeans.org/issues/show_bug.cgi?id=143303
The attachment (ui.tar.gz) to this CR are made based on the following test class:
package jlabelcheck;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class Main {
public static void main(String[] args) {
String[] lafs = {"javax.swing.plaf.metal.MetalLookAndFeel",
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel",
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
};
for (String laf : lafs) {
try {
UIManager.getInstalledLookAndFeels();
UIManager.setLookAndFeel(laf);
JLabel label = new JLabel();
JFrame theFrame = new JFrame("Label Test");
theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
theFrame.setLayout(new GridBagLayout());
Container contentPane = theFrame.getContentPane();
contentPane.add(label,
new GridBagConstraints(0,0,0,0,1,1,GridBagConstraints.CENTER, // anchor
GridBagConstraints.BOTH, // fill
new Insets(11, 11, 0, 11), // padding
0, 0));
theFrame.setSize(400, 300);
theFrame.setLocation(600, 400);
theFrame.setVisible(true);
label.setText("<html><br>This is the HTML string sample.<br>" +
"This is <b>bold</b> font example.<br>" +
"<i>This string is in italic</i><br><br>" +
"This is list : <ul><li>first item</li><li>next item</li><li>last one</li></ul>" +
"<br><p style=\"font-size:1.2em\">This is big size string</p>");
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
theFrame.setVisible(false);
} catch (ClassNotFoundException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (UnsupportedLookAndFeelException ex) {
}
}
System.exit(0);
}
}
Metal and Nimbus is fine but when using GTK L&F the font size increase more that by 50% and overall design flaws.
It happens with any JDK.
Originally reporeted in NetBeans IssueZilla agains NetBeans Installer:
http://www.netbeans.org/issues/show_bug.cgi?id=143303
The attachment (ui.tar.gz) to this CR are made based on the following test class:
package jlabelcheck;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class Main {
public static void main(String[] args) {
String[] lafs = {"javax.swing.plaf.metal.MetalLookAndFeel",
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel",
"com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
};
for (String laf : lafs) {
try {
UIManager.getInstalledLookAndFeels();
UIManager.setLookAndFeel(laf);
JLabel label = new JLabel();
JFrame theFrame = new JFrame("Label Test");
theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
theFrame.setLayout(new GridBagLayout());
Container contentPane = theFrame.getContentPane();
contentPane.add(label,
new GridBagConstraints(0,0,0,0,1,1,GridBagConstraints.CENTER, // anchor
GridBagConstraints.BOTH, // fill
new Insets(11, 11, 0, 11), // padding
0, 0));
theFrame.setSize(400, 300);
theFrame.setLocation(600, 400);
theFrame.setVisible(true);
label.setText("<html><br>This is the HTML string sample.<br>" +
"This is <b>bold</b> font example.<br>" +
"<i>This string is in italic</i><br><br>" +
"This is list : <ul><li>first item</li><li>next item</li><li>last one</li></ul>" +
"<br><p style=\"font-size:1.2em\">This is big size string</p>");
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
theFrame.setVisible(false);
} catch (ClassNotFoundException ex) {
} catch (InstantiationException ex) {
} catch (IllegalAccessException ex) {
} catch (UnsupportedLookAndFeelException ex) {
}
}
System.exit(0);
}
}