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.