diff -r d6dafc5d983f -r 1627c337e51e javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/StringItemTests2.java --- a/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/StringItemTests2.java Fri Oct 15 12:29:39 2010 +0300 +++ b/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/StringItemTests2.java Fri Oct 29 11:49:32 2010 +0300 @@ -63,6 +63,8 @@ // Commands for the StringItems private Command cmdItem1 = new Command("Itemcommand1", Command.ITEM, 1); private Command cmdItem2 = new Command("Itemcommand2", Command.ITEM, 1); + // Command to exit the MIDlet + private Command cmdExit = new Command("Exit", Command.EXIT, 1); /** * Signals the MIDlet to start and enter the Active state. @@ -81,6 +83,7 @@ mainForm.addCommand(cmdAdd); mainForm.addCommand(cmdForward); + mainForm.addCommand(cmdExit); mainForm.setCommandListener(this); stringItemForm.addCommand(cmdBack); stringItemForm.addCommand(cmdClear); @@ -112,17 +115,17 @@ */ public void commandAction(Command c, Displayable s) { - if (c == cmdAdd) + if(c == cmdAdd) { // Create correct type of stringitem int index = cgType.getSelectedIndex(); - if (index == 0) + if(index == 0) si = new StringItem("", "", Item.PLAIN); else { - if (index == 1) + if(index == 1) si = new StringItem("", "", Item.HYPERLINK); - else if (index == 2) + else if(index == 2) si = new StringItem("", "", Item.BUTTON); si.addCommand(cmdItem1); si.addCommand(cmdItem2); @@ -131,7 +134,7 @@ // Set the label index = cgLabel.getSelectedIndex(); - if (index == 0) + if(index == 0) si.setLabel(""); else si.setLabel(cgLabel.getString(index)); @@ -142,18 +145,22 @@ Display.getDisplay(this).setCurrent(stringItemForm); } - else if (c == cmdBack) + else if(c == cmdBack) { Display.getDisplay(this).setCurrent(mainForm); } - else if (c == cmdClear) + else if(c == cmdClear) { stringItemForm.deleteAll(); } - else if (c == cmdForward) + else if(c == cmdForward) { Display.getDisplay(this).setCurrent(stringItemForm); } + else if(c == cmdExit) + { + this.notifyDestroyed(); + } } public void commandAction(Command c, Item i)