-
Bug
-
Resolution: Fixed
-
P4
-
8
-
b22
-
x86
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8350877 | 17.0.16-oracle | Alexey Ivanov | P4 | Resolved | Fixed | master |
JDK-8350879 | 11.0.28-oracle | Alexey Ivanov | P4 | Resolved | Fixed | master |
JDK-8350968 | 8u461 | Alexey Ivanov | P4 | Resolved | Fixed | master |
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.
- backported by
-
JDK-8350877 JOptionPane bungles HTML messages
-
- Resolved
-
-
JDK-8350879 JOptionPane bungles HTML messages
-
- Resolved
-
-
JDK-8350968 JOptionPane bungles HTML messages
-
- Resolved
-