用java编写的图形用户界面,运行后怎么关闭?

2024-11-22 22:26:26
推荐回答(3个)
回答1:

fr.addWindowListener(new WindowAdapter(){

@Override public void windowClosing(WindowEvent e){
System.exit(0);
}
});

回答2:

需要在main方法中设置退出操作

回答3:

public eqq (){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
e.getWindow().dispose();
System.exit(0);
}
});
}