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

📄 fivemidlet.java

📁 j2me上的FIR游戏 从原代码光盘上复制
💻 JAVA
字号:


import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

public class FiveMIDlet extends MIDlet
    implements CommandListener
{   
    private Display display;
    private Form frmFive;
    private Image imgLogo;
    private Command cmdExit;
    private Command cmdGo;
    private Command cmdOptions;
    private Command cmdReg;
    private StringItem siReg;
    private FiveCanvas cavFive;
    private Options options;
    private Reg reg;
    private static String strAbout = "";

    public FiveMIDlet()
    {
        display = Display.getDisplay(this);
        reg = new Reg(this);
        frmFive = new Form(null);
        try
        {
            imgLogo = Image.createImage("/Five.png");
        }
        catch(IOException _ex)
        {
            imgLogo = Image.createImage(1, 1);
        }
        frmFive.append(imgLogo);
        frmFive.append("GoBang Game\n");
        siReg = new StringItem(null, null);
        frmFive.append("   \n");
        frmFive.append("Version 1.0.2");
        frmFive.append("   \n");
        frmFive.append("   \n");
        frmFive.append("仅供学习范例\n");
        frmFive.append("   \n");

        cmdExit = new Command("退出", 7, 1);
        cmdGo = new Command("开局", 4, 2);
        cmdOptions = new Command("设置", 1, 3);
        cmdReg = new Command("\u6CE8\u518C", 1, 4);
        frmFive.addCommand(cmdGo);
        frmFive.addCommand(cmdOptions);
        frmFive.addCommand(cmdReg);
        frmFive.addCommand(cmdExit);
        frmFive.setCommandListener(this);
        refreshRegInfo();
        cavFive = new FiveCanvas(this, reg);
        options = new Options(this);
    }

    public void startApp()
    {
        display.setCurrent(frmFive);
    }

    public void pauseApp()
    {
    }

    public void destroyApp(boolean flag1)
    {
    }

    public void commandAction(Command c, Displayable s)
    {
        if(c == cmdExit)
        {
            destroyApp(false);
            notifyDestroyed();
        } else
        if(c == cmdGo)
        {
            display.setCurrent(cavFive);
            cavFive.setOptions(options.borderSize(), options.computerFirst(), options.degree());
            cavFive.newStage();
        } else
        if(c == cmdOptions)
            display.setCurrent(options.frmOptions());
        else
        if(c == cmdReg)
        {
            reg.register(display);
            refreshRegInfo();
        }
    }

    public void backHome()
    {
        refreshRegInfo();
        display.setCurrent(frmFive);
    }

    private void refreshRegInfo()
    {
        String sReg = "[Rigstered]\n";
        frmFive.addCommand(cmdGo);
        frmFive.removeCommand(cmdReg);
    }



    static 
    {
        strAbout = "";
    }
}

⌨️ 快捷键说明

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