-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6u10
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0_10-beta"
Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b23)
Java HotSpot(TM) Client VM (build 11.0-b11, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The function "getBaseline", used by layout, doesn't work anymore for a button with Html content, in Nimbus LAF.
It throws an IllegalArgumentException, when the button calls getBaseline on the html content.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Example :
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Exception e)
{
e.printStackTrace();
}
JFrame frame = new JFrame();
JButton button = new JButton("<html><u>test</u>");
//JButton button = new JButton("test");
frame.getContentPane().add(button);
frame.setVisible(true);
button.getBaseline(10, 10);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A button with underlined text
ACTUAL -
Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
at javax.swing.plaf.basic.BasicHTML.getHTMLBaseline(Unknown Source)
at javax.swing.plaf.synth.SynthButtonUI.getBaseline(Unknown Source)
at javax.swing.JComponent.getBaseline(Unknown Source)
at FastTest.main(FastTest.java:34)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
at javax.swing.plaf.basic.BasicHTML.getHTMLBaseline(Unknown Source)
at javax.swing.plaf.synth.SynthButtonUI.getBaseline(Unknown Source)
at javax.swing.JComponent.getBaseline(Unknown Source)
at FastTest.main(FastTest.java:34)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.UIManager;
public class FastTest
{
/**
* @param args
*/
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Exception e)
{
e.printStackTrace();
}
JFrame frame = new JFrame();
JButton button = new JButton("<html><u>test</u>");
//JButton button = new JButton("test");
frame.getContentPane().add(button);
frame.setVisible(true);
button.getBaseline(10, 10);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
to bypass this bug, the only solution is to not use html content for button
java version "1.6.0_10-beta"
Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b23)
Java HotSpot(TM) Client VM (build 11.0-b11, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The function "getBaseline", used by layout, doesn't work anymore for a button with Html content, in Nimbus LAF.
It throws an IllegalArgumentException, when the button calls getBaseline on the html content.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Example :
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Exception e)
{
e.printStackTrace();
}
JFrame frame = new JFrame();
JButton button = new JButton("<html><u>test</u>");
//JButton button = new JButton("test");
frame.getContentPane().add(button);
frame.setVisible(true);
button.getBaseline(10, 10);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A button with underlined text
ACTUAL -
Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
at javax.swing.plaf.basic.BasicHTML.getHTMLBaseline(Unknown Source)
at javax.swing.plaf.synth.SynthButtonUI.getBaseline(Unknown Source)
at javax.swing.JComponent.getBaseline(Unknown Source)
at FastTest.main(FastTest.java:34)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
at javax.swing.plaf.basic.BasicHTML.getHTMLBaseline(Unknown Source)
at javax.swing.plaf.synth.SynthButtonUI.getBaseline(Unknown Source)
at javax.swing.JComponent.getBaseline(Unknown Source)
at FastTest.main(FastTest.java:34)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.UIManager;
public class FastTest
{
/**
* @param args
*/
public static void main(String[] args)
{
try {
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
catch (Exception e)
{
e.printStackTrace();
}
JFrame frame = new JFrame();
JButton button = new JButton("<html><u>test</u>");
//JButton button = new JButton("test");
frame.getContentPane().add(button);
frame.setVisible(true);
button.getBaseline(10, 10);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
to bypass this bug, the only solution is to not use html content for button