JOptionPane.
showMessageDialog
(
null
,
"
错误消息!
"
,
"
错误
"
,
JOptionPane.
ERROR_MESSAGE
);
JOptionPane.
showMessageDialog
(
null
,
"
信息消息。
"
,
“
提示
"
, JOptionPane.
INFORMATION_MESSAGE
);
JOptionPane.
showMessageDialog
(
null
,
"
警告对话
框!
"
,
"
警告
"
,
JOptionPane.
WARNING_MESSAGE
);
JOptionPane.
showMessageDialog
(
null
,
"
没有图标
的提示!
"
,
"
信息
"
,
JOptionPane.
PLAIN_MESSAGE
);
Icon icon =
new
ImageIcon(getClass().getResource(
"middle.gif
"
));
JOptionPane.
showMessageDialog
(
null
,
"
自定义图片的信息提示!
"
,
"
信息
"
,
JOptionPane.
INFORMATION_MESSAGE
, icon);
Object[] options = {
"
是的
"
,
"
不是
"
,
"
不确定
"
};
int
n =
JOptionPane.
showOptionDialog
(
this
,
"
你喜欢看定影吗?
"
,
"
自定义询问
"
,
JOptionPane.
YES_NO_CANCEL_OPTION
,
JOptionPane.
QUESTION_MESSAGE
,
null
, options, options[2]);