我有这个:
JOptionPane.showMessageDialog(null, " " + company1 +
" Has Higher A Market Value\nThan " + company2,
"Information", JOptionPane.INFORMATION_MESSAGE);
Run Code Online (Sandbox Code Playgroud)
我想让company1和company2在对话框中显示为粗体.我尝试使用html格式,但(我想)显然不起作用.
任何线索或提示?
TIA!
Jig*_*shi 27
使用 HTML
JOptionPane.showMessageDialog(null, "<html> <b> Has </b>Higher A Market Value</html> ");
Run Code Online (Sandbox Code Playgroud)
如果您的默认字体不支持它,那么您可以指定它
String msg = "<html>This is how to get:<ul><li><i>italics</i> and "
+ "<li><b>bold</b> and "
+ "<li><u>underlined</u>...</ul></html>";
JLabel label = new JLabel(msg);
label.setFont(new Font("serif", Font.PLAIN, 14));
JOptionPane.showConfirmDialog(null, label);
Run Code Online (Sandbox Code Playgroud)
输出:

| 归档时间: |
|
| 查看次数: |
23236 次 |
| 最近记录: |