All pastes #205516 Raw Edit

Miscellany

public text v1 · immutable
#205516 ·published 2006-10-16 21:33 UTC
rendered paste body

// the command for your class
Command listCommand = new Command("click", CommandType.ITEM, 1);

// your menu
myList.append("item 1", null);
myList.append("item 2", null);

// setting the menu to use this command
myList.setCommand(listCommand);

// your implementation of commandAction
public void commandAction(Command c, Displayable d) {
  // are we the list?
  if (d == myList && c == listCommand) {
    int selectedItem = myList.getSelectedIndex();
    System.out.println("item " + selectedItem + " was clicked!");
  }
}