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

📄 showscore.java~39~

📁 俄罗斯方块游戏,大学时写的,支持单机及点对点网络对战!同时我还在里面加入了使用技能的功能!不过有一个缺点,呵呵好象代码写的不够严谨,所以现在性能很低,我一直也没有优化它!
💻 JAVA~39~
字号:
package ct;import java.awt.*;import javax.swing.*;//public class showScore extends Panel implements Runnable{  int m_nTheScore;  int m_nPlayLevel;  Tetrics ntetrics;  JLabel jLabel1 = new JLabel();  BorderLayout borderLayout1 = new BorderLayout();  public showScore(Tetrics tts) {   ntetrics=tts;   this.setBackground(new Color(24,104,203)); try {      jbInit();       myinit();    }    catch(Exception e) {      e.printStackTrace();    }  }  public void myinit(){    m_nTheScore=0;    m_nPlayLevel=5;  }  //更新游戏界面   public void update(Graphics g)   {            paint(g);//绘制新游戏页面   }  public void paint(Graphics g){    g.fillRect(0,0,100,60);    g.setFont(new Font("宋体",1,16));//字体 大小   // String tempString=String.valueOf(m_nTheScore);    //FontMetrics FM;   // FM=g.getFontMetrics();    //打印Score和level的位置       //  g.setColor(new Color(10,10,10));     //  g.drawString("score:" + m_nTheScore,0,20-1 );    //   g.drawString("score:" + m_nTheScore,0, 20);     //  g.drawString("score:" + m_nTheScore,0,20);   //    g.drawString("score:" + m_nTheScore,0, 20+1);      // g.setColor(new Color(3,255,157));    //   g.drawString("score:" + m_nTheScore,0,20);       g.drawString("score:" + m_nTheScore,0,20);    //      g.setColor(new Color(10,10,10));    //      g.drawString("level:"+m_nPlayLevel,0,50-1);     //     g.drawString("level:"+m_nPlayLevel,0,50);     //     g.drawString("level:"+m_nPlayLevel,0,50);    //      g.drawString("level:"+m_nPlayLevel,0,50+1);     //     g.setColor(new Color(3,255,157));      //    g.drawString("level:"+m_nPlayLevel,0,50);          g.drawString("level:"+m_nPlayLevel,0,50);  }  public void run(){   repaint();  }  public showScore() {    try {      jbInit();    }    catch(Exception e) {      e.printStackTrace();    }  }  private void jbInit() throws Exception {    jLabel1.setText("");    this.setLayout(borderLayout1);    this.add(jLabel1, BorderLayout.NORTH);    jLabel1.setIcon(new ImageIcon("../ct/score.png"));  }}

⌨️ 快捷键说明

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