这段代码定义了一个MyFrame类的构造方法,构造方法中首先调用了modelChoose()方法来选择游戏模式,如果返回-1则程序退出。接着创建了一个MyPanel对象,并将其放置在MyFrame窗口中,同时将MyPanel对象设置为键盘监听器。然后设置MyFrame的大小、关闭操作,并将其设置为可见。

在MyFrame窗口关闭时,会将敌方坦克的子弹清空,并将游戏记录对象Recorder写入文件recorder1.txt中。最后关闭对象输出流。

public MyFrame throws Exception int i=modelChoose; if i==-1 Systemexit0; 程序退出 myPanel = new MyPaneli; new ThreadmyPanelstart; thissetSize

原文地址: https://www.cveoy.top/t/topic/hw4t 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录