简体   繁体   中英

Message is cut off on dialog box

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

在此处输入图片说明

there is my code:

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM