日期:2014-05-20 浏览次数:20805 次
import java.awt.Frame; import java.awt.event.*; public class $2121_Key { class $2121_Window extends Frame{ $2121_Window(){ this.setBounds(100, 100, 100, 100); this.addKeyListener(new KeyAdapter(){ public void keyPressed(KeyEvent e){ if(e.getKeyCode()==e.VK_KP_DOWN){ //我想在这里实现窗口的关闭,怎么写? //因为是内部类 //不能用System.exit(0); } } }); this.setVisible(true); } } }