fr.addWindowListener(new WindowAdapter(){
@Override public void windowClosing(WindowEvent e){
System.exit(0);
}
});
需要在main方法中设置退出操作
public eqq (){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
e.getWindow().dispose();
System.exit(0);
}
});
}