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

📄 cscoreui.java

📁 网上收集的
💻 JAVA
字号:
package chiidanceapp;import java.awt.Image;import java.awt.Graphics;import javax.swing.JPanel;import java.awt.Font;import java.util.ResourceBundle;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class CScoreUI implements Runnable{  static ResourceBundle res = ResourceBundle.getBundle("chiidanceapp.Res1");  private int xCloud1 = 0;  private int xCloud2 = 800;  private Image Cloud1,                Cloud2;  private Image Panel;  private Image Sumomo;  private int Score;  CLoad Load;  private boolean isLoaded = false;  private boolean canRun = true;  private Thread aThread;  public CScoreUI() {    Load = new CLoad();    Score = Load.loadScore();    Load();    aThread = new Thread( this );    aThread.start();  }  public void Load()  {    CImage initImage = new CImage();    Cloud1  = initImage.LoadImage( "Resource/img/cloud.jpg" );    Cloud2  = initImage.LoadImage( "Resource/img/cloud.jpg" );    Panel   = initImage.LoadImage( "Resource/img/RecordPanel.png" );    Sumomo  = initImage.LoadImage( "Resource/img/sumomo.gif" );    isLoaded = true;  }  public void setScore( int Score )  {    this.Score = Score;  }  public void destruct()  {    Cloud1 = null;    Cloud2 = null;    Panel  = null;    Sumomo = null;    isLoaded = false;    canRun   = false;  }  public void paint( Graphics g,JPanel GamePanel )  {    if( isLoaded )    {      g.drawImage( Cloud1,xCloud1,0,GamePanel );      g.drawImage( Cloud2,xCloud2,0,GamePanel );      g.drawImage( Panel,240,206,GamePanel );      g.drawImage( Sumomo,240,226,GamePanel );      g.setFont( new Font( "Monospaced",Font.PLAIN,21 ) );      g.drawString( "目前最高分:",340,246 );      g.setFont( new Font( "Monospaced",Font.BOLD,21 ) );      g.drawString( ""+Score+"分",350,286 );    }  }  public void run() {    while( canRun )    {      xCloud1 --;      xCloud2 --;      if( xCloud1 <= -800 )      {        xCloud1 = 800;      }      if( xCloud2 <= -800 )      {        xCloud2 = 800;      }      if( xCloud1 == 0 )      {        xCloud1 = -xCloud1;      }     try {        aThread.sleep( 20 );      }      catch ( InterruptedException ex ) {      }    }  }}

⌨️ 快捷键说明

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