?? brick.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 + -