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

📄 brick.java

📁 新功能坦克大战
💻 JAVA
字号:
import java.awt.*;import javax.swing.*;import java.io.*;public class Brick extends JFrame {        TankFrame tankFrame;    int num=300;    Wall wall[]=new Wall[num];    int grade;    int x,y;    int c;    int no=0;    Brick(TankFrame tankFrame,int grade) throws Exception{          this.tankFrame=tankFrame;        this.grade=grade;               ShowWall();    }    public void ShowWall() throws Exception{        x=0;        y=40;        FileReader fr=new FileReader(grade+".txt");        while((c=(int)fr.read())!=-1){               if(c==59){                y+=20;                x=0;            }            else if((c-48)==0){                x+=20;            }            else if((c-48==1)){                wall[no]=new Wall(x,y,1,tankFrame);                x+=20;                no++;            }            else if(c-48==2){                wall[no]=new Wall(x,y,2,tankFrame);                x+=20;                no++;            }        }        fr.close();    }    public void paint(Graphics g){        for(int i=0;i<num;i++){            if(wall[i]!=null)                wall[i].draw(g);        }    }}

⌨️ 快捷键说明

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