Search code examples
javaswingappletlinejoptionpane

How to insert one line in Applet?


I would like to insert one line between "total charges"and "Thank you..."

Here is the code I have made so far:

JOptionPane.showMessageDialog(null, "Total Charges : RM" + dollar.format(totalCharges) + "Thank you please come again");

How can I do this? Thank You


Solution

  • Use HTML formatting. Something like this should work:

    JOptionPane.showMessageDialog(null, 
        "<html><body>Total Charges : RM" 
        + dollar.format(totalCharges) 
        + "<br>Thank you please come again");