f05c4cceb617001c1dc48a59085d713a
来自「java编写的一个坦克大战游戏」· 代码 · 共 47 行
TXT
47 行
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class MainArea extends Frame {
public void launchFrame()
{
this.setLocation(100,100);
this.setSize(500,500);
this.setVisible(true);
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
);
}
public void paint(Graphics g)
{
Color c=g.getColor();
g.setColor(Color.RED);
for(int i=0;i<19;i++)
{
g.drawLine(100,100,(100+i*5),200);
}
//g.drawLine(100,100,200,200);
g.setColor(c);
}
public static void main(String[] args) {
MainArea ma=new MainArea();
ma.launchFrame();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?