b0d7aa02c117001c1dc48a59085d713a

来自「java编写的一个坦克大战游戏」· 代码 · 共 49 行

TXT
49
字号
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class MainArea extends  Panel{

	public void launchFrame()
	{
	   this.setLocation(100,100);
	   this.setSize(450,450);
	   this.setVisible(true);
	   this.setBackground(Color.GRAY);
	   
	  // this.setResizable(false);
	  // 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++)
		{
			int t=40+i*20;
			int t1=40+400;	
			g.drawLine(40,t,400,t);
			g.drawLine(t,40,t,400);
		}
		
		//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 + -
显示快捷键?