package com.shrimpking.t6;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/**
* Created by IntelliJ IDEA.
*
* @Author : Shrimpking
* @create 2024/9/23 15:08
*/
//ch18-3
public class CloseFrame
{
public static void main(String[] args)
{
Frame frame = new Frame();
frame.setSize(500,300); //尺寸
frame.setTitle("Hello Java GUI"); //标题
frame.addWindowListener(new WindowAdapter()
{
//窗体关闭事件
@Override
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
frame.setVisible(true);
}
}