俄罗斯方块—— java 源代码俄罗斯方块—— java 源代码提供 import .*; import .*; // 俄罗斯方块类 public class ERS_Block extends Frame{ public static boolean isPlay=false; public static int level=1,score=0; public static TextField scoreField,levelField; public static MyTimer timer; GameCanvas gameScr; public static void main(String[] argus){ ERS_Block ers = new ERS_Block(" 俄罗斯方块游戏 Author:Vincent"); WindowListener win_listener = new WinListener(); (win_listener); } // 俄罗斯方块类的构造方法 ERS_Block(String title){ super(title); setSize(600,480); setLayout(new GridLayout(1,2)); gameScr = new GameCanvas(); (gameScr); timer = new MyTimer(gameScr); (true); (); (); add(gameScr); Panel rightScr = new Panel(); (new GridLayout(2,1,0,30)); (120,500); add(rightScr); // 右边信息窗体的布局 MyPanel infoScr = new MyPanel(); (new GridLayout(4,1,0,5)); (120,300); (infoScr); // 定义标签和初始值 Label scorep = new Label(" 分数:",); Label levelp = new Label(" 级数:",); scoreField = new TextField(8); levelField = new TextField(8); (false); (false); (scorep); (scoreField); (levelp); (levelField); (new Dimension(20,60)); (new Dimension(20,60)); (new Dimension(20,60)); (new Dimension(20,60)); ("0"); ("1"); // 右边控制按钮窗体的布局 MyPanel controlScr = new MyPanel(); (new GridLayout(5,1,0,5)); (controlScr); // 定义按钮 play Button play_b = new Button(" 开始游戏"); (new Dimension(50,200)); (,gameScr)); // 定义按钮 Level UP Button level_up_b = new Button(" 提高级数"); (new Dimension(50,200)); (,gameScr)); // 定义按钮 Level Down Button level_down_b
俄罗斯方块——java源代码 来自淘豆网m.daumloan.com转载请标明出处.