Methods Summary |
---|
private void | addCommands(javax.microedition.lcdui.Displayable d)
d.addCommand(exitCommand);
d.addCommand(backCommand);
d.setCommandListener(this);
|
public void | commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
if (d == examplesList) {
// New example selected
int index = examplesList.getSelectedIndex();
display.setCurrent(canvases[index]);
} else if (c == exitCommand) {
// Exit. No need to call destroyApp
// because it is empty.
notifyDestroyed();
} else if (c == backCommand) {
// Go back to main selection list
display.setCurrent(examplesList);
}
|
private void | createCanvases()
canvases = new Canvas[examples.length];
canvases[0] = createDrawImageCanvas();
canvases[1] = createImageGraphicsCanvas();
|
private void | createCommands()
exitCommand = new Command("Exit", Command.EXIT, 0);
backCommand = new Command("Back", Command.BACK, 1);
|
private javax.microedition.lcdui.Canvas | createDrawImageCanvas()
Canvas canvas = new DrawImageCanvas();
addCommands(canvas);
return canvas;
|
private javax.microedition.lcdui.Canvas | createImageGraphicsCanvas()
Canvas canvas = new ImageGraphicsCanvas();
addCommands(canvas);
return canvas;
|
private void | createList()
examplesList = new List("Select Example", List.IMPLICIT);
for (int i = 0; i < examples.length; i++) {
examplesList.append(examples[i], null);
}
examplesList.setCommandListener(this);
|
protected void | destroyApp(boolean unconditional)
|
protected void | pauseApp()
|
protected void | startApp()
if (!started) {
started = true;
display = Display.getDisplay(this);
// Create the common commands
createCommands();
// Create the canvases
createCanvases();
// Create the list of examples
createList();
// Start with the List
display.setCurrent(examplesList);
}
|