您好,欢迎访问一九零五行业门户网

Java中对话框的弹出

近在做学校的课程设计,java编程需要用到对话框弹出,第一反应是js中的alert和confirm,java的话瞬间懵,查阅学习总结如下,用以以后的学习
1.显示一个错误对话框,该对话框显示的 message 为 'alert':
joptionpane.showmessagedialog(null, alert, alert, joptionpane.error_message);
2.显示一个内部信息对话框,其 message 为 'information':
joptionpane.showinternalmessagedialog(frame, information,information, joptionpane.information_message);
3.显示一个信息面板,其 options 为 yes/no,message 为 'choose one':
joptionpane.showconfirmdialog(null, choose one, choose one, joptionpane.yes_no_option);
4.显示一个内部信息对话框,其 options 为 yes/no/cancel,message 为 'please choose one',并具有 title 信息:
joptionpane.showinternalconfirmdialog(frame, 
please choose one, information, 
joptionpane.yes_no_cancel_option, 
joptionpane.information_message);
5.显示一个警告对话框,其 options 为 ok、cancel,title 为 'warning',message 为 'click ok to continue':
object[] options = { ok, cancel }; 
joptionpane.showoptiondialog(null, click ok to continue, warning, 
joptionpane.default_option, joptionpane.warning_message, 
null, options, options[0]);
6.显示一个要求用户键入 string 的对话框:
string inputvalue = joptionpane.showinputdialog(please input a value);
7.显示一个要求用户选择 string 的对话框:
object[] possiblevalues = { first, second, third }; 
object selectedvalue = joptionpane.showinputdialog(null, choose one, input, 
joptionpane.information_message, null, 
possiblevalues, possiblevalues[0]);
其它类似信息

推荐信息