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

📄 splash.java

📁 simple mobile basketball game!It is very good!
💻 JAVA
字号:
package com.linden.pocketbasketball;
import javax.microedition.lcdui.*;
import java.io.*;
import java.util.*;

public class Splash extends Canvas implements CommandListener {
    private Image screenshot;
    private TestMidletMIDlet parent;
    private Timer timer;
    
    /**
     * constructor
     */
    public Splash(TestMidletMIDlet parent) {
        this.parent = parent;
        try {
            // Set up this canvas to listen to command events
            setCommandListener(this);
            // Add the Exit command
            addCommand(new Command("进入游戏", Command.EXIT, 1));
        } catch(Exception e) {
            e.printStackTrace();
        }
        
        try {
            screenshot = Image.createImage("/com/linden/pocketbasketball/Images/splash.png");
        }
        catch(IOException e) {}
        startTimer();
    }
    
    public void startTimer() {
        TimerTask gotoMenu = new TimerTask()  {
            public void run() {
            	timer.cancel();
            	parent.setCurrent("MainMenu2");
            }
        };
        timer = new Timer();
        timer.schedule(gotoMenu, 3000);
    }
    
    /**
     * paint
     */
    public void paint(Graphics g) {
    	g.setColor(255, 255, 255);
    	g.fillRect(0, 0, this.getWidth(), this.getHeight());
    	g.drawImage(screenshot, (this.getWidth() - 128) / 2, (this.getHeight() - 128) / 2, Graphics.TOP|Graphics.LEFT);
    }
    
    /**
     * Called when action should be handled
     */
    public void commandAction(Command command, Displayable displayable) {
        timer.cancel();
        parent.setCurrent("MainMenu2");
    }
    
}

⌨️ 快捷键说明

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