J2SE 坦克大战 马士兵(2)

来源:互联网 发布:c语言中-i 是什么意思 编辑:程序博客网 时间:2024/04/28 06:05

项目二的具体要求:


代码:public class TankClient extends Frame{
public void lanuchFrame(){
this.setLocation(300,200);
this.setSize(800,600);
this.setResizable(false);
setVisible(true);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
                Frame f =(Frame)e.getSource();
                f.setVisible(false);
}
});

      //添加嵌套类,继承WindowAdapter接口,主要是WindowListener接口方法多,重写很麻烦
}
public static void main(String[] args) {
      new TankClient().lanuchFrame();
}

}

原创粉丝点击