-
Bug
-
Resolution: Fixed
-
P4
-
8
-
b22
-
x86
-
windows_7
FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
Because a plain JLabel does not do line breaks, JOptionPane splits multiline strings across multiple JLabels. This breaks HTML messages.
In this example, line 1 of the message has correct underline formatting; but line 2 has three problems: (1) it has no underline; (2) it is split onto a third line even though \n should be insignificant whitespace in this HTML; (3) it displays the `</u>` literally:
import javax.swing.*;
class Test {
public static void main(String... args) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null, "<html><u>line 1<br>\nline\n2</u>");
});
}
}
Workaround/fix: Use a single JLabel for HTML messages:
JOptionPane.showMessageDialog(null, new JLabel("<html><u>line 1<br>\nline\n2</u>"));
REPRODUCIBILITY :
This bug can be reproduced always.
A DESCRIPTION OF THE PROBLEM :
Because a plain JLabel does not do line breaks, JOptionPane splits multiline strings across multiple JLabels. This breaks HTML messages.
In this example, line 1 of the message has correct underline formatting; but line 2 has three problems: (1) it has no underline; (2) it is split onto a third line even though \n should be insignificant whitespace in this HTML; (3) it displays the `</u>` literally:
import javax.swing.*;
class Test {
public static void main(String... args) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(null, "<html><u>line 1<br>\nline\n2</u>");
});
}
}
Workaround/fix: Use a single JLabel for HTML messages:
JOptionPane.showMessageDialog(null, new JLabel("<html><u>line 1<br>\nline\n2</u>"));
REPRODUCIBILITY :
This bug can be reproduced always.