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

📄 mainmenu.java

📁 游戏名称:九宫阵 运行平台:j2me 规范:midp 说明:一款很经典的游戏源码
💻 JAVA
字号:
/*
 * Copyright (C) 2005-2006 Leopardo.f
 *
 * This file is part of M-SuDoKu, a J2ME version of SuDoKu.
 *
 * M-SuDoKu is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 * 
 * M-SuDoKu is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public
 * License along with M-SuDoKu; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.  Or, visit http://www.gnu.org/copyleft/gpl.html
 */

package MSuDoKu;

import javax.microedition.lcdui.*;

/**
 * List subclass implementing the game main menu
 * @author Leopardo.f
 */
public class MainMenu extends List implements CommandListener {
    
    protected App app;
    protected String[] saStrings;
//  protected Command cmdAbout, cmdHelp, cmdExit, cmdSelect, cmdCancel;
    protected Command cmdCancel;
    
    /** Creates a new instance of MainMenu
     * @param app the App class instance that uses this object
     * @param sa the string array containing the menu items
     * @see App
     */
    public MainMenu (App app, String[] sa) {
        super (Utils.sAppName, Choice.IMPLICIT);
        this.app = app;
        saStrings = sa;
        
        append (saStrings[Utils.HELP], null);
        append (saStrings[Utils.LEVEL], null);
        append (saStrings[Utils.BACKGROUND], null);
        append (saStrings[Utils.ABOUT], null);
        append (saStrings[Utils.INPUT], null);
        append (saStrings[Utils.RESTART], null);
        append (saStrings[Utils.SOLUTION], null);
        append (saStrings[Utils.SKIP], null);
        append (saStrings[Utils.EXIT], null);
//        cmdSelect = new Command (saStrings[Utils.SELECT], Command.OK, 2);
        cmdCancel = new Command (saStrings[Utils.CANCEL], Command.OK, 1);
//        cmdHelp = new Command (saStrings[Utils.HELP], Command.ITEM, 99);
//        cmdAbout = new Command (saStrings[Utils.ABOUT], Command.ITEM, 99);
//        cmdExit = new Command (saStrings[Utils.EXIT], Command.ITEM, 99);
        
//        addCommand (cmdExit);
//        addCommand (cmdAbout);
//        addCommand (cmdHelp);
        addCommand (cmdCancel);
//        addCommand (cmdSelect);
        setCommandListener (this);
    }
    
    public void commandAction (Command c, Displayable d)
    {
        if (c == cmdCancel)
            app.showBoard();
        else
        {
            switch (getSelectedIndex())
            {
                case -1 : break;
                case 0 : app.showHelp(); break;
                case 1 : app.showLevel(); break;
                case 2 : app.showBackground(); break;
                case 3 : app.showAbout(); break;
                case 4 : app.showInput(); break;
                case 5 : app.restartRequested(); break;
                case 6 : app.showSolution(); break;
                case 7 : app.skip(); break;
                case 8 : app.exitRequested(); break;
            }
        }
    }
}

⌨️ 快捷键说明

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