How to make font bold in java dialogue box?

前端 未结 1 1814
失恋的感觉
失恋的感觉 2020-12-17 18:28

I have this:

JOptionPane.showMessageDialog(null, \" \" + company1 + 
            \" Has Higher A Market Value\\nThan \" + company2,
                \"Informa         


        
1条回答
  •  半阙折子戏
    2020-12-17 19:00

    Use HTML

    JOptionPane.showMessageDialog(null, "  Has Higher A Market Value ");
    

    If your default font doesn't support it then you can specify it like

     String msg = "This is how to get:
    • italics and " + "
    • bold and " + "
    • underlined...
    "; JLabel label = new JLabel(msg); label.setFont(new Font("serif", Font.PLAIN, 14)); JOptionPane.showConfirmDialog(null, label);

    Output:

    alt text

    0 讨论(0)
提交回复
热议问题