日期:2014-05-18 浏览次数:20789 次
package swing;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
public class JFrameTest extends JFrame{
public JFrameTest()
{
this.setTitle("JFrame Test");
this.setSize(400, 300);
this.setLocation(300, 300);
this.setVisible(true);
}
public static void main(String[] args)
{
new JFrameTest().addWindowListener( new WindowAdapter(){
public void WindowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);