0

The message is cut off on dialog box. Would someone tell me how to solve it. Thanks in advance.

enter image description here

there is my code:

 public static void DisplayErrorMsg(String msg){
    //custom title, error icon
     JOptionPane.showMessageDialog(null,
         msg,
         "Error",
         JOptionPane.ERROR_MESSAGE);
 }
user819774
  • 1,456
  • 1
  • 19
  • 48

1 Answers1

0

you can use html tags (e.g. <p> ) to accomplish word wrap functionality in JOPtionPane. use

JOptionPane.showMessageDialog(null, "<p style='width:300px;'>"+msg+"</p>", "Error", JOptionPane.ERROR_MESSAGE);

Mukesh Soni
  • 1,119
  • 3
  • 13
  • 23