java awt 窗口关不掉,应该加什么?

2024-12-22 00:17:08
推荐回答(3个)
回答1:

import java.awt.Frame;
public class text3{
private Frame f;

public text3(){
f = new Frame("Let's study java");
}

public void launchFrame(){
f.setSize(400,200);
f.setVisible(true);
f.setdefaultoperation(dispose......)有这方法,具体我记不得了,
}

public static void main(String[] args){
text3 guiWindow = new text3();
guiWindow.launchFrame();
}

}

回答2:

f.addWindowListener(new WindowAdapter(){
@Override public void windowClosing(WindowEvent e){
System.exit(0);

}

});

回答3:

ctrl加ait加.