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 javax.microedition.lcdui.Canvas | createArcsCanvas()
Canvas canvas = new ArcsCanvas();
addCommands(canvas);
return canvas;
|
private void | createCanvases()
canvases = new Canvas[examples.length];
canvases[0] = createLinesCanvas();
canvases[1] = createRectanglesCanvas();
canvases[2] = createRectangleFillsCanvas();
canvases[3] = createArcsCanvas();
canvases[4] = createFilledArcsCanvas();
canvases[5] = createTextCanvas();
|
private void | createCommands()
exitCommand = new Command("Exit", Command.EXIT, 0);
backCommand = new Command("Back", Command.BACK, 1);
|
private javax.microedition.lcdui.Canvas | createFilledArcsCanvas()
Canvas canvas = new FilledArcsCanvas();
addCommands(canvas);
return canvas;
|
private javax.microedition.lcdui.Canvas | createLinesCanvas()
Canvas canvas = new LineCanvas();
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);
|
private javax.microedition.lcdui.Canvas | createRectangleFillsCanvas()
Canvas canvas = new RectangleFillsCanvas();
addCommands(canvas);
return canvas;
|
private javax.microedition.lcdui.Canvas | createRectanglesCanvas()
Canvas canvas = new RectanglesCanvas();
addCommands(canvas);
return canvas;
|
private javax.microedition.lcdui.Canvas | createTextCanvas()
Canvas canvas = new TextCanvas();
addCommands(canvas);
return canvas;
|
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);
}
|