📄 inputmenu.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 input mode choice menu
* @author Leopardo.f
*/
public class InputMenu extends List implements CommandListener {
protected App app;
protected String[] saStrings, saInputStrings;
// protected Command cmdSelect, cmdCancel;
protected Command cmdCancel;
protected byte currentInput = PuzzleModel.NUMPAD;
/** Creates a new instance of LevelMenu
* @param app the App class instance that uses this object
* @param sal the string array containing the input mode menu items
* @param sa the string array containing the main menu items
* @see App
*/
public InputMenu (App app, String[] sal, String[] sa) {
super (Utils.sAppName, Choice.IMPLICIT);
this.app = app;
saInputStrings = sal;
saStrings = sa;
append ((currentInput == PuzzleModel.NUMPAD ? "[x]" : "") + saInputStrings[PuzzleModel.NUMPAD], null);
append ((currentInput == PuzzleModel.NONUMPAD ? "[x]" : "") + saInputStrings[PuzzleModel.NONUMPAD], null);
append ((currentInput == PuzzleModel.JOYPADNUMPAD ? "[x]" : "") + saInputStrings[PuzzleModel.JOYPADNUMPAD], null);
// cmdSelect = new Command (saStrings[Utils.SELECT], Command.OK, 1);
// cmdCancel = new Command (saStrings[Utils.CANCEL], Command.CANCEL, 1);
cmdCancel = new Command (saStrings[Utils.CANCEL], Command.OK, 1);
addCommand (cmdCancel);
// addCommand (cmdSelect);
setCommandListener (this);
}
public void setCurrentInput (byte ci)
{
currentInput = ci;
set (PuzzleModel.NUMPAD, (currentInput == PuzzleModel.NUMPAD ? "[x]" : "") + saInputStrings[PuzzleModel.NUMPAD], null);
set (PuzzleModel.NONUMPAD, (currentInput == PuzzleModel.NONUMPAD ? "[x]" : "") + saInputStrings[PuzzleModel.NONUMPAD], null);
set (PuzzleModel.JOYPADNUMPAD, (currentInput == PuzzleModel.JOYPADNUMPAD ? "[x]" : "") + saInputStrings[PuzzleModel.JOYPADNUMPAD], null);
}
public void commandAction (Command c, Displayable d)
{
if (c == cmdCancel)
app.showBoard();
else
{
switch (getSelectedIndex())
{
case -1 : break;
case 0 : app.changeInputMode (PuzzleModel.NUMPAD); break;
case 1 : app.changeInputMode (PuzzleModel.NONUMPAD); break;
case 2 : app.changeInputMode (PuzzleModel.JOYPADNUMPAD); break;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -