dispose().关闭当前窗口
setvisiable设置可见性
ConfirmDialog --- 确认对话框,提出问题,然后由用户自己来确认(按"Yes"或"No"按钮)
InputDialog --- 提示输入文本
MessageDialog --- 显示信息
JOptionPane.showConfirmDialog(null, "choose one", "choose one", JOptionPane.YES_NO_OPTION);
案例
int num=JOptionPane.showConfirmDialog(null,"提示类容","提示标题",JOptionPane.YES_NO_CANCEL_OPTION);
System.out.println(num);
消息提示
JOptionPane.showMessageDialog(null,"gogogo");
请用户输入
String s=JOptionPane.showInputDialog("请输入");
System.out.println(s);
时间: 2024-10-29 00:18:48