-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6
-
x86
-
windows_vista
FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6000]
A DESCRIPTION OF THE PROBLEM :
When HTML in a JLabel contains a <p>, I would expect it to leave a blank line between the two paragraphs as it does for a JTextPane. However, this is not the case.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The label should display:
"Line One
Line Two"
ACTUAL -
The label actually displays:
"Line One
Line Two"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class Test {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, new JLabel("<html>Line One<p>Line Two</html>"));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can double the paragraphs like so: <p><p>.
This is less than satisfactory as the HTML specification says that empty paragraphs should not be rendered, hence it is conceivable that on some JREs this may actually be the case.
You can also use <br><br>, which is slightly better as long as you're willing to lose semantics.
There is probably another workaround involving overriding the View used to render the label, but I don't know how to do it.
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6000]
A DESCRIPTION OF THE PROBLEM :
When HTML in a JLabel contains a <p>, I would expect it to leave a blank line between the two paragraphs as it does for a JTextPane. However, this is not the case.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the sample program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The label should display:
"Line One
Line Two"
ACTUAL -
The label actually displays:
"Line One
Line Two"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class Test {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, new JLabel("<html>Line One<p>Line Two</html>"));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can double the paragraphs like so: <p><p>.
This is less than satisfactory as the HTML specification says that empty paragraphs should not be rendered, hence it is conceivable that on some JREs this may actually be the case.
You can also use <br><br>, which is slightly better as long as you're willing to lose semantics.
There is probably another workaround involving overriding the View used to render the label, but I don't know how to do it.