六上同步学典答案:这段java代码是什么意思

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/05 04:09:24
if (JOptionPane.showConfirmDialog(frame // may want to pass your application frame here
,p
,"Login"
,JOptionPane.OK_CANCEL_OPTION
,JOptionPane.PLAIN_MESSAGE
) == JOptionPane.OK_OPTION) {
System.out.println("User Name:"+tfUserName.getText());
System.out.println("Password:" + new String(tfPassword.getPassword()));
}

JOptionPane.showConfirmDialog(frame // may want to pass your application frame here
,p
,"Login"
,JOptionPane.OK_CANCEL_OPTION
,JOptionPane.PLAIN_MESSAGE
*******************************************
showConfirmDialog(Component parentComponent, Object message, String title, int optionType, int messageType)
调用一个由 optionType 参数确定其中选项数的对话框,messageType 参数确定要显示的图标。
。。。=JOptionPane.OK_OPTION
点了确认按钮后输出用户名和密码
点了取消则不满足if条件,不输出

这是混淆后的反编译代码
s;是得到传入的参数,
JVM INSTR swap 是 赋值语句。就是把s的值赋给s1;

用JOptionPane的showConfirmDialog方法取得登陆信息,并打印出来