![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIn5GcuIXY0N3Xu92Yp9CXzV2Zh1WavwVbvNmLllXZ0lmL3gjN5gzN3gjMxcHavw1LcpDc0RHaiojIsJye.png)
package com.swing.messagebox;
import javax.swing.joptionpane;
public class guiutil23
{
public static final string message_warning = " 警告";
public static final string message_information = " 消息";
public static final string message_error = " 错误";
private guiutil23()
{
throw new error("don't let anyone instantiate this class.");
}
/***
* warning boxes
*
* @param mesg
*/
public static void warningdialog(string mesg)
joptionpane
.showmessagedialog(
null,
"<html><font color=\"yellow\" style=\"font-weight:bold;" +
"background-color:#666666\" >"
+ mesg + "</font></html>", message_warning,
joptionpane.warning_message);
* error
public static void errordialog(string mesg)
"<html><font color=\"red\" style=\"font-weight:bold;" +
"background-color:white\" >"
+ mesg + "</font></html>", message_error,
joptionpane.error_message);
* information
public static void infodialog(string mesg)
joptionpane.showmessagedialog(null,
"<html><font color=\"green\" style=\"font-weight:bold;\" >" + mesg
+ "</font></html>", message_information,
joptionpane.information_message);
}