下载此文档

JAVA俄罗斯方块源代码.doc


文档分类:IT计算机 | 页数:约20页 举报非法文档有奖
1/20
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/20 下载此文档
文档列表 文档介绍
不多说,, 直接可以拷贝下面的东西, 然后记得把那个 BLOCK 的名字改成你自己的类名, 这个很关键哦,不然是错的可别怪我,呵呵~~ import .*; import .*; import .*; import .*; import .*; import .*; import .*; public class Block extends JPanel implements ActionListener,KeyListener // 应该是继承 JPanel { static Button but [] = new Button[6]; static Button noStop = new Button( " 取消暂停" ); static Label scoreLab = new Label( " 分数:" ); static Label infoLab = new Label( " 提示:" ); static Label speedLab = new Label( " 级数:" ); static Label scoreTex = new Label( "0" ); static Label infoTex = new Label( "" ); static Label speedTex = new Label( "1" ); static JFrame jf = new JFrame(); static MyTimer timer ; static ImageIcon icon = new ImageIcon( "resource/" ); static JMenuBar mb = new JMenuBar(); static JMenu menu0 = new JMenu( " 游戏" ); static JMenu menu1 = new JMenu( " 帮助" ); static JMenuItem mi0 = new JMenuItem( " 新游戏" ); static JMenuItem mi1 = new JMenuItem( " 退出" ); static JMenuItem mi1_0 = new JMenuItem( " 关于" ); static JDialog dlg_1 ; static JTextArea dlg_1_text = new JTextArea(); static int startSign = 0; // 游戏开始标志 0 未开始 1 开始 2 暂停 static String butLab [] ={" 开始游戏"," 重新开始"," 降低级数"," 提高级数"," 游戏暂停"," 退出游戏" }; static int game_body [][] = new int [19][10]; static int game_sign_x [] = new int [4]; // 用于记录 4 个方格的水平位置 static int game_sign_y [] = new int [4]; // 用于记录 4 个方格的垂直位置 static boolean downSign = false ; // 是否落下 static int blockNumber = 1; // 砖块的编号 static int gameScore = 0; // 游戏分数 static int speedMark = 1; public static void main(String args[]) { Block myBlock = new Block(); mb .add( menu0 ); mb .add( menu1 ); menu0 .add( mi0 ); menu0 .add( mi1 ); menu1 .add( mi1_0 ); jf .setJMenuBar( mb ); (); jf .add(myBlock); jf .setSize(565,501); jf .setResizable( false ); jf .setTitle( " 俄罗斯方块" ); jf .setIconImage( icon .getImage()); jf .setLocation(200,100); jf . show () ; timer = new MyTimer(myBlock); // 启动线程 timer .setDaemon( true ); timer .start(); tim

JAVA俄罗斯方块源代码 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数20
  • 收藏数0 收藏
  • 顶次数0
  • 上传人yixingmaob
  • 文件大小0 KB
  • 时间2016-06-30