实现界面登陆,退出功能的java代码怎么写?

 我来答
英雄如何如何356
推荐于2019-08-01 · TA获得超过187万个赞
知道顶级答主
回答量:72.2万
采纳率:52%
帮助的人:3.6亿
展开全部
CS结构系统的退出如下:public void init() {
this.setTitle("用户登录界面");
this.add(createCenterPane());
this.setDefaultCloseOperation(this.DO_NOTHING_ON_CLOSE);
this.setSize(new Dimension(450, 335));
this.setLocationRelativeTo(null);
// this.setVisible(true);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
int choose = JOptionPane.showConfirmDialog(null, "是否要退出登录界面?",
"系统提示:", JOptionPane.YES_NO_OPTION);
if (choose == JOptionPane.YES_OPTION) {
System.exit(1);
}
}
});
}其中this为JFrame对象。BS结构的退出直接用windows.close()方法就行了!
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式