public void startApp() { display.setCurrent(lsProducts); }
public void pauseApp() { }
public void destroyApp(boolean unconditional) { }
public void showAlert() { try { // Create an image Image im = Image.createImage("/help.png");
// Create Alert, add text and image, no sound alHelp = new Alert("Help Information", "Bob's Pretty Good Products...so much to choose from!", im, null); alHelp.setTimeout(Alert.FOREVER); alHelp.setTicker(tkSale); } catch(Exception e) { System.out.println("Unable to read png image."); }
// Display the Alert. Once dismissed, return to product list display.setCurrent(alHelp, lsProducts);
}
public void commandAction(Command c, Displayable s) {
if (c == List.SELECT_COMMAND) { switch (lsProducts.getSelectedIndex()) { case 0: System.out.println("Laptop selected"); break;
case 1: System.out.println("Printer selected"); break;
case 2: showAlert(); break; } } else if (c == cmExit) { destroyApp(true); notifyDestroyed(); } } }