如何关闭preious框架 [英] how to close preious frame
本文介绍了如何关闭preious框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好。我正在创建一个项目,其中我创建了一个管理员登录框架。我在这里给出了管理员名称文本字段,密码字段和登录按钮。当我输入正确的管理员名称和密码时,会打开一个名为管理员面板的新框架。我想要的是关闭管理员登录框架并点击登录按钮打开管理面板。
请帮助我。
thanx in advanced
Hi. I am creating a project in which i have created a Admin login frame.I have given here adminname text field ,password field and a login button. when i entered correct adminname and password then a new frame open named Admin panel. the thing i want is to close the admin login frame and open admin Panel on clicking the login button.
please help me.
thanx in advanced
推荐答案
public void actionPerformed(ActionEvent arg0)
{
new GUI();//next frame
dispose();
}
or frame1.setVisible(false);
can help u.
一些建议的解决方案 [ ^ ]。
使用:
Use this:
loginButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
if(//check if the admin and password are corect){
frameToClose.dispose();//dispose previous frame
//create the other frame or set its setVisible()method to true
}else{
//display error message
//something like incorrect user or password
}
}
});
它应该可以工作。
It should work.
这篇关于如何关闭preious框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文