[英]how to close all the jframes while opening the main jframe
I made a desktop application with 3 frames { "login" , "Choice" , "name" }.我制作了一个带有 3 帧 { “login” 、 “Choice” 、 “name” } 的桌面应用程序。 the mainframe is "login" , and when you log in the choice frame appears that lets you choose a search method (I only use 1 frame "name" for this example) .主机是“登录” ,当您登录时会出现选择框,让您选择搜索方法(本例中我只使用 1 框“名称” ) 。 Now when I log out from "Choice" , the "Choice" closes and the "login" frame appears, BUT the "name" frame gonna be still open.现在,当我从"Choice"注销时, "Choice"关闭并出现"login"框架,但 "name" 框架仍将打开。 So How I close all the frames while opening the mainframe?那么如何在打开大型机的同时关闭所有框架?
THIS IS MY FUNCTION:这是我的 FUNCTION:
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {
//log out
login log=new login();
log.setVisible(true);
this.dispose();// this only close the Choice frame not all the frames
}
Login: enter image description here choice: enter image description here登录:在此处输入图像描述 选择:在此处输入图像描述
try this once试试这个
Menu menu = new Menu();
Menu.show();
this.hide();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.