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

📄 webiscreen.java

📁 关于j2me的宠物游戏!!!!!!!!!!! 希望打架提出意见
💻 JAVA
字号:
/*
 * WebiScreen.java
 *
 * Created on 2006年5月5日, 上午11:59
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package DogPet;


import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.lcdui.*;

//            Game_control

class WebiScreen extends Canvas
{
    private static final String welcome = "Welcome to WebiNeti";
    Image image[];
    private Image image_bg;
    private Game_control game_control;
    private Timer timer;
    private int flashDuration;
    int swapped;
    boolean timers;
    int now_times;
    private int sel;
    
    class Task19 extends TimerTask
    {

        public final void run()
        {
            if(timers)
            {
                now_times = now_times + 1;
                swapped = swapped + 1;
                if(swapped > image.length - 1)
                    swapped = 0;
                repaint();
            }
        }

        Task19()
        {
        }
    }

    public WebiScreen(Game_control gc)
    {
        image = new Image[4];
        image_bg = null;
        timer = new Timer();
        flashDuration = 200;
        swapped = 0;
        timers = true;
        now_times = 0;
        sel = 1;
        game_control = gc;
        try
        {
            image_bg = Image.createImage("/dog.png");
        }
        catch(Exception ex) { }
        for(int i = 0; i < image.length; i++);
        timer.scheduleAtFixedRate(new Task19(), 0L, flashDuration);
    }

    public void paint(Graphics g)
    {
        g_cls(g, 0xffffff);
        g.setColor(0xff0000);
        g.setFont(Font.getFont(0, 200, 0));
        g.drawString("WebiNeti Splash", 50, 50, 20);
        if(now_times > 100)
        {
            image = null;
            killed();
            game_control.gamesplash();
        }
    }

    protected void keyPressed(int keyCode)
    {
        if(game_control != null)
        {
            killed();
            image = null;
            game_control.gamesplash();
        }
    }

    public void killed()
    {
        timer.cancel();
        timer = null;
    }

    public void g_cls(Graphics g, int setcolor)
    {
        g.setColor(setcolor);
        g.fillRect(0, 0, getWidth(), getHeight());
        g.drawImage(image_bg, 0, 0, 20);
    }

}

⌨️ 快捷键说明

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