//如何关闭窗口
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class awtDemo10 {
public static void main(String[] args) {
Frame frame=new Frame();
frame.setBounds(100,100,500,300);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setVisible(true);
}
}
点击X就可以实现关闭窗口了