📄 settingscreen.java
字号:
package com.gowin.firstgame;
import javax.microedition.lcdui.*;
public class SettingScreen extends Form implements CommandListener {
private Elimilator midlet;
private Command okCommand = new Command( "OK" , Command.SCREEN , 1 );
private Command backCommand = new Command( "Back" , Command.BACK , 1 );
private Setting setting;
private static final String[] difficultyOption = {"Easy","Medium","Hard"};
private static final String[] autoFireOption = {"Off","on"};
private ChoiceGroup difficulty;
private ChoiceGroup autoFire;
public SettingScreen( Elimilator midlet , Setting setting) throws Exception{
super("Settings" );
this.midlet = midlet;
this.setting = setting;
difficulty = new ChoiceGroup("Difficulty",
ChoiceGroup.POPUP,difficultyOption,null);
autoFire = new ChoiceGroup("AutoFire",
ChoiceGroup.POPUP,autoFireOption,null);
append( difficulty );
append( autoFire );
addCommand( backCommand );
addCommand( okCommand );
setCommandListener(this);
}
public void commandAction(Command cmd, Displayable displayable) {
if( okCommand == cmd ){
processMenu();
}
else if( backCommand == cmd){
midlet.mainMenuScreenShow();
}
else{
processMenu();
}
}
private void processMenu() {
setting.updateSetting(difficulty.getSelectedIndex()+1 , autoFire.getSelectedIndex());
midlet.mainMenuScreenShow();
}
public void init() throws Exception{
setting.loadSetting();
difficulty.setSelectedIndex(setting.getDifficulty()-1 , true);
autoFire.setSelectedIndex(setting.getAutoFire(), true);
}
private void setControls() {
System.out.println("setControls");
}
private void setDifficulty() {
System.out.println("setDifficulty");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -