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

📄 settings.java

📁 孤单惊魂
💻 JAVA
字号:
import javax.microedition.lcdui.*;import javax.microedition.midlet.*;public class Settings    extends Form implements CommandListener, ItemStateListener {  private static Displayable instance;  synchronized public static Displayable getInstance() {    if (instance == null) {      instance = new Settings();    }    return instance;  }  public static int difficulty = 0;  public static boolean volume1 = true;  private ChoiceGroup cg1 = new ChoiceGroup("难度设定:", Choice.EXCLUSIVE);  private ChoiceGroup cg2 = new ChoiceGroup("音量设定:", Choice.EXCLUSIVE);  private Image image = null;  public Settings() {    super("游戏设定");    cg1.append("简单", image);    cg1.append("普通", image);    cg1.append("恶梦", image);    append(cg1);    append(cg2);    cg2.append("音量开", image);    cg2.append("音量关", image);    setItemStateListener(this);    addCommand(new Command("返回", Command.BACK, 1));    setCommandListener(this);  }  public void itemStateChanged(Item item) {    String label = item.getLabel();    if (label.equals("难度设定:")) {      difficulty = cg1.getSelectedIndex();    }    else if (label.equals("音量设定:")) {      int i = cg2.getSelectedIndex();      if (i == 0) {        volume1 = true;      }      else {        volume1 = false;      }    }  }  public void commandAction(Command c, Displayable s) {    Navigator.flow(c.getLabel());  }}

⌨️ 快捷键说明

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