⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1027856af014001c16bced549d67331d

📁 java编写的一个坦克大战游戏
💻
字号:
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class TankClient extends Frame {

	public void launchFrame()
	{
		this.setLocation(300,300);
		this.setSize(800,600);
		
		this.addWindowListener(new WindowAdapter()
			{
			    public void windowClosing(WindowEvent e)
			   {
				  System.exit(0);
			   }
			}
		);
		new Thread(new PaintThread()).start();
		this.setResizable(false);	
		this.setVisible(true);	
	}
	
	public void paint(Graphics g)
	{
		Color c=g.getColor();
		g.setColor(Color.RED);
		g.fillOval(30,30,50,50);
		g.setColor(c);	
	}
	
	private class PaintThread implements Runnable
	{
		public void run() {
               while(true)
               {
            	   repaint();
    			   try {
    				 Thread.sleep(100);
    			   } catch (InterruptedException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			   }
            	   
            	   
               }
			  
			
		}
		
	}
	
	
	
	
	public static void main(String[] args) {
		TankClient tc=new TankClient();
		tc.launchFrame();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -