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

📄 logocanvas.java~11~

📁 一个手机游戏菜单登入界面
💻 JAVA~11~
字号:
package gamemidlet;

import javax.microedition.lcdui.*;

/**
 * <p>Title: 黄小辉8000106286网通062班</p>
 * <p>Description: GameMIDlet</p>
 * <p>Copyright: Copyright (c) 2009</p>
 * <p>Company: NCU</p>
 * @author not attributable
 * @version 1.0
 */

public class LogoCanvas
    extends Canvas
    implements Runnable {
  int stayTime;
  Font nowfont;
  Image logoImg=null;
  int currentTime;
  //Thread thread;
  String CorpName = "Game Play 2009";
  public LogoCanvas(int stayTime) {
    currentTime = 0;
    this.stayTime=stayTime;
    nowfont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
    logoImg = GameMIDlet.loadImage("/pic/companylogo.png");
    this.setFullScreenMode(true);

  }

  public void startRunning() {
    Display.getDisplay(GameMIDlet.instance).setCurrent(this);
    //thread=new Thread(this);
    (new Thread(this)).start();
  }

  private void showSplashScreen() {
  SplashCanvas splash=new SplashCanvas(2000);
  Display.getDisplay(GameMIDlet.instance).setCurrent(splash);
  }

  public void run() {
    for (; currentTime < stayTime; currentTime += 50) {
      try {
        Thread.sleep(50L);      }
      catch (InterruptedException interuptedexception) {}
        showSplashScreen();
    }
  }

  protected void paint(Graphics g) {
    int x = (this.getWidth() - logoImg.getWidth()) / 2;
    int y = (this.getHeight() - logoImg.getHeight()) / 2;
    g.setColor(0X00FFFFFF);
    g.fillRect(0, 0, this.getWidth(), this.getHeight());
    g.drawImage(logoImg, x, y - 5, Graphics.TOP | Graphics.LEFT);
    g.setColor(255, 0, 0);
    g.setFont(nowfont);
    int fontW = nowfont.stringWidth(CorpName);
    int fontH = nowfont.getHeight();
    g.drawString(CorpName, (this.getWidth() - fontW) / 2, y + logoImg.getHeight(),
                 Graphics.TOP | Graphics.LEFT);
  }

  protected void keyPressed(int i) {
    currentTime = stayTime;
  }
}

⌨️ 快捷键说明

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