public class MyGameFrame extends JFrame {
public void paint(Graphics g) {
g.drawLine(100,100,300,300);
}
/*
* 初始化窗口
*/
public void launchFrame() {
this.setTitle("打飞机小游戏");
this.setVisible(true);//设置为可见
this.setSize(500,500);//设置窗口的长度、宽度
this.setLocation(300,300);//设置窗口的位置
/*
* 设置关闭窗口功能
*/
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public static void main(String[] args)
{
MyGameFrame f = new MyGameFrame();
f.launchFrame();
f.setVisible(true);
}
}
那你那
相关分类