📄 dxbenchmarkermidlet.java
字号:
/* * BenchpressSuiteMIDlet.java * * Created on den 1 juli 2003, 13:08 * * This MIDlet suite was made to test graphics and process-power on * arbitrary mobile platform supporting midp 1.0. * Code for GraphicsTest is based on the "Bounce.java" made by Magnus Larsson. * In addition to GraphicsTest the midlet needs Adder, Multiplier and CharacterTest classes. */package DXBenchmarker;import javax.microedition.midlet.*;import javax.microedition.lcdui.*;/** * The DXBenchmarkerMIDlet contains GraphicsTest, Adder, Multiplier and CharacterTest * * @author 23046803 * @version */public class DXBenchmarkerMIDlet extends MIDlet implements CommandListener { private Command exitCommand; // The exit command private Command okCommand; // the affirm command private Display display; // The display for this MIDlet private ChoiceGroup choiceGroup; // Choices displayed // Inner classes private Chooser chooser; private GraphicsTest graphicsTest; private Adder adder; private Multiplier multiplier; private CharacterTest characterTest; //Possible choices private static int CHOICE_GRAPHICSTEST = 0; private static int CHOICE_ADDER = 1; private static int CHOICE_MULTIPLIER = 2; private static int CHOICE_CHARACTERTEST = 3; /** * Constructor - sets display * */ public DXBenchmarkerMIDlet() { display = Display.getDisplay(this); exitCommand = new Command("Exit", Command.EXIT, 2); } /** * Starts the MIDlet by calling on the inner class Chooser which displays a * list of possible choices. */ public void startApp() { try { chooser = new Chooser(); chooser.addCommand(exitCommand); chooser.setCommandListener(this); display.getDisplay(this).setCurrent(chooser);// graphicsTest = new GraphicsTest(display, chooser);// adder = new Adder(display, chooser);// multiplier = new Multiplier(display, chooser);// characterTest = new CharacterTest(display, chooser); } catch(Exception e) { System.out.println(e.getMessage()); } } /** * */ public void pauseApp() { } /** * */ public void destroyApp(boolean unconditional) { } /* * Respond to commands, including exit * On the exit command, cleanup and notify that the MIDlet has been destroyed. */ public void commandAction(Command c, Displayable s) { if (c == exitCommand) { destroyApp(false); notifyDestroyed(); } if (c == List.SELECT_COMMAND) { if (chooser.getSelectedMIDletByIndex() == CHOICE_GRAPHICSTEST) { GameSplash gameSplash = new GameSplash(display, chooser); Thread thread = new Thread(gameSplash); thread.start(); display.getDisplay(this).setCurrent(gameSplash); } if (chooser.getSelectedMIDletByIndex() == CHOICE_ADDER) { display.getDisplay(this).setCurrent(new Adder(display, chooser)); } if (chooser.getSelectedMIDletByIndex() == CHOICE_MULTIPLIER) { display.getDisplay(this).setCurrent(new Multiplier(display, chooser)); } if (chooser.getSelectedMIDletByIndex() == CHOICE_CHARACTERTEST) { display.getDisplay(this).setCurrent(new CharacterTest(display, chooser)); } } } private class Chooser extends List { public Chooser() { super("Choose application", List.IMPLICIT); append("GraphicsTest", null); append("Adder", null); append("Multiplier", null); append("CharacterTest", null);/* super("Choose application"); choiceGroup = new ChoiceGroup(null, Choice.EXCLUSIVE); choiceGroup.append("GraphicsTest", null); choiceGroup.append("Adder", null); choiceGroup.append("Multiplier", null); choiceGroup.append("CharacterTest", null); append(choiceGroup); */ } public int getSelectedMIDletByIndex() { return chooser.getSelectedIndex(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -