.间接继承窗体适配器WindowAdapter
, b" G# z/ R/ u, C
, i. X& Y0 _2 Y* L
# Q1 \0 i2 `3 [/ o4 Z! n //Frame1.java import java.awt.*; import java.awt.event.*; public class Frame1 extends Frame { public Frame1() { this.setSize(new Dimension(400, 300)); this.setTitle("Frame1"); this.addWindowListener(new winAdapter()); this.setVisible(true); } public static void main(String[] s){ new Frame1(); } } class winAdapter extends WindowAdapter{ public void windowClosing(WindowEvent windowEvent) { System.exit(0); } } |