关闭副窗口,却把主窗口也关闭了???
下面是一个录取的程序,点击菜单中的 "录取 "后选择子菜单 "录取 ",会弹出一个子窗口,但是假如我把这个子窗口关掉的话,主窗口也部执行.郁闷 ...
代码如下:
====================================================
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
class z_Launch{
TextField z_tName;
TextField z_tID ;
TextField z_tTotal ;
TextField z_tSports;
Label z_l1;//设置居中
Label z_l2 ;
Label z_l3 ;
Label z_l4;
Button z_bEnroll = new Button( "录取 ");
Button z_bReset = new Button( "重置 ");
z_Launch(){
////////////////////////////////
///设置登陆框
Frame z_Launch = new Frame( "登陆 ");
z_Launch.setLayout(new GridLayout(5,2));
z_tName = new TextField();
z_tID = new TextField();
z_tTotal = new TextField();
z_tSports = new TextField();
z_l1 = new Label( "用户名 ",Label.CENTER);//设置居中
z_l2 = new Label( "考号 ",Label.CENTER);
z_l3 = new Label( "综合成绩 ",Label.CENTER);
z_l4 = new Label( "体育成绩 ",Label.CENTER);
z_bEnroll = new Button( "录取 ");
z_bReset = new Button( "重置 ");
z_Launch.add(z_l1);
z_Launch.add(z_tName);
z_Launch.add(z_l2);
z_Launch.add(z_tID);
z_Launch.add(z_l3);
z_Launch.add(z_tTotal);
z_Launch.add(z_l4);
z_Launch.add(z_tSports);
z_Launch.add(z_bEnroll);
z_Launch.add(z_bReset);
z_Launch.pack();
z_Launch.setBounds(100,200,300,200);
z_Launch.setResizable(false);
z_Launch.setVisible(true);