求用JAVA写俄罗斯方块游戏的源代码。
俄罗斯方块-Java源代码提供导入Java . awt . *;导入Java . awt . event . *;//俄罗斯方块类public classes _ block extensions frame { public static Boolean is play = false;public static int level=1,score = 0;公共静态TextField scoreField、levelField公共静态MyTimer计时器;GameCanvas gameScrpublic static void main(string[]argus){ ers _ blockers =新人_ block("俄罗斯方块游戏V1.0作者:Vincent ");window listener win _ listener = new win listener();ers . addwindowlistener(win _ listener);}//俄罗斯方块类构造方法ers _ block(string title){ super(title);setSize(600,480);set layout(new GridLayout(1,2));game Cr = new game canvas();games Cr . addkey listener(games Cr);timer = new my timer(gameScr);timer . set daemon(true);timer . start();timer . suspend();添加(gameScr);Panel rights Cr = new Panel();rights Cr . set layout(new GridLayout(2,1,0,30));rights Cr . setsize(120500);add(rights Cr);//右侧信息表单的布局my panel info SCR = new my panel();info SCR . set layout(new GridLayout(4,1,0,5));infoScr.setSize(120,300);rights Cr . add(infos Cr);//定义标签和初始值标签scorep = new label ("score:",Label。左);标签级别p =新标签("系列:",标签。左);score field = new TextField(8);level field = new TextField(8);score field . set editable(false);level field . set editable(false);info SCR . add(scorep);info SCR . add(score field);info SCR . add(levelp);info SCR . add(level field);scorep.setSize(新维度(20,60));scoreField.setSize(新维度(20,60));levelp.setSize(新维度(20,60));levelField.setSize(新维度(20,60));score field . settext(" 0 ");level field . settext(" 1 ");//右侧控件按钮窗体的布局my panel controls Cr = new my panel();control SCR . set layout(new GridLayout(5,1,0,5));rights Cr . add(controls Cr);//定义按钮play Button play_b = new Button("开始游戏");play_b.setSize(新维度(50,200));play_b.addActionListener(新命令(Command.button_play,gameScr));//定义按钮级别up button level _ up _ b = new button("改善系列");level_up_b.setSize(新维度(50,200));level _ up _ b . addactionlistener(new Command(Command . button _ level up,gameScr));//定义按钮级别down button level _ down _ b = new button(" reduce series ");level_down_b.setSize(新维度(50,200));level _ down _ b . addactionlistener(new Command(Command . button _ level down,gameScr));//定义按钮级暂停按钮pause _ b = new按钮("游戏暂停");pause_b.setSize(新维度(50,200));pause _ b . addactionlistener(new Command(Command . button _ pause,gameScr));//定义按钮Quit Button quit_b = new Button("退出游戏");quit_b.setSize(新维度(50,200));quit_b.addActionListener(新命令(Command.button_quit,gameScr));controls Cr . add(play _ b);control SCR . add(level _ up _ b);control SCR . add(level _ down _ b);control SCR . add(pause _ b);control SCR . add(quit _ b);set visible(true);games Cr . request focus();} }//重写MyPanel类,在Panel类mypanel extensions panel周围留出空间{ public inserts get inserts(){ return new inserts(30,50,30,50);} }//游戏画布类游戏画布扩展Canvas实现Key Listener { final int unitsize = 30;//小方块边长int rowNum//正方形的行数为int columnNum//正方形中的列数,int maxAllowRowNum//允许多少行未切割的int blockInitRow//新块起始行的坐标,int blockInitCol//新块的起始列坐标int[][]scrar;//屏幕数组块b;//对方快速参考canvas类GameCanvas(){ rowNum = 15的构造方法;column num = 10;maxAllowRowNum = rowNum-2;b =新块(this);block initrow = rowNum-1;blockInitCol = column num/2-2;scrArr = new int[32][32];}//初始化屏幕并清除屏幕数组以void init SCR(){ for(int I = 0;我& ltrowNumi++)for(int j = 0;j & ltcolumnNumj++)scrArr[j]= 0;b . reset();repaint();}//刷新画布方法public void paint(graphics g){ for(int I = 0;我& ltrowNumi++)for(int j = 0;j & ltcolumnNumj++) drawUnit(i,j,scrArr[j]);}//绘制一个框的方法public void draw unit (int row,int col,int type){ scrarr[row][col]= type;graphics g = get graphics();Tch(type){ //表示绘制快速case 0的方法:g . set color(color . black);打破;//绘制case 1:g . set color(color . blue)以背景为颜色;打破;//画一个下落的正方形案例2:g . set color(color . magenta);打破;//画图的方法已经落后} g.fill3drect (col * unitsize,getsize()。height-(row+1) * unitsize,unitsize,true);g . dispose();} public Block get Block(){ return b;//返回对块实例的引用}//返回屏幕数组中位置(row,col)的属性值,public int getscrarrxy (int row,int col) {if (row