With the lack of size on the screen, MIDP does not describe a menu bar. To replace the bar menu, the MIDlet has Commands. Command usually implemented as a softkey or an item in a menu. Command object only contains information about the actionthat must be done at the time of the Command is activated. She did not contain thecode to be executed when the command is selected. Property CommandListener fromDisplayable contains the action to be executed when Command is activated.CommandListener a specific interface on a single method:
public void commandAction(Command command, Displayable displayable)
Mapping of Commands on the equipment depends on a predetermined number orprogrammable button on the equipment. If the number of Command is not true at all thebuttons, it allows the equipment to put some or all of the Command on the menu andthe map on the menu and the button will be labeled "Menu".
Command exitCommand = new Command("Exit", Command.EXIT, 1);
Command newCommand = new Command("New Item", Command.OK, 1);
Command renameCommand = new Command("Rename Item", Command.OK, 1);
Command deleteCommand = new Command("Delete Item", Command.OK, 1);
...
list.addCommand(exitCommand);
list.addCommand(newCommand);
list.addCommand(renameCommand);
list.addCommand(deleteCommand);
Tidak ada komentar:
Posting Komentar