<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FJ2ME%2FStringItem</id>
		<title>Java/J2ME/StringItem - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FJ2ME%2FStringItem"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/J2ME/StringItem&amp;action=history"/>
		<updated>2026-04-21T21:36:25Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/J2ME/StringItem&amp;diff=7257&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/J2ME/StringItem&amp;diff=7257&amp;oldid=prev"/>
				<updated>2010-06-01T06:37:42Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 06:37, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/J2ME/StringItem&amp;diff=7256&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/J2ME/StringItem&amp;diff=7256&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== StringItem Alternative ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*--------------------------------------------------&lt;br /&gt;
* StringItemAlternative.java&lt;br /&gt;
*&lt;br /&gt;
* Example from the book:     Core J2ME Technology&lt;br /&gt;
* Copyright John W. Muchow   http://www.CoreJ2ME.ru&lt;br /&gt;
* You may use/modify for any non-commercial purpose&lt;br /&gt;
*-------------------------------------------------*/&lt;br /&gt;
import javax.microedition.midlet.*;&lt;br /&gt;
import javax.microedition.lcdui.*;&lt;br /&gt;
public class StringItemAlternative extends MIDlet implements CommandListener&lt;br /&gt;
{&lt;br /&gt;
  private Display display;      // Reference to Display object for this MIDlet&lt;br /&gt;
  private Form fmMain;         // The main form&lt;br /&gt;
  private Command cmNext;      // Next label and message&lt;br /&gt;
  private Command cmExit;      // Command to exit the MIDlet&lt;br /&gt;
  private int msgIndex;         // Index of our message text on form&lt;br /&gt;
  private static int count = 0; // How many times through our loop&lt;br /&gt;
  public StringItemAlternative()&lt;br /&gt;
  {&lt;br /&gt;
    display = Display.getDisplay(this);&lt;br /&gt;
    // Create commands&lt;br /&gt;
    cmNext = new Command(&amp;quot;Next&amp;quot;, Command.SCREEN, 1);&lt;br /&gt;
    cmExit = new Command(&amp;quot;Exit&amp;quot;, Command.EXIT, 1);&lt;br /&gt;
    // Create Form, add Command &amp;amp; message, listen for events&lt;br /&gt;
    fmMain = new Form(&amp;quot;Preferences&amp;quot;);    &lt;br /&gt;
    fmMain.addCommand(cmExit);&lt;br /&gt;
    fmMain.addCommand(cmNext);    &lt;br /&gt;
    &lt;br /&gt;
    // Save the index location of this item&lt;br /&gt;
    msgIndex = fmMain.append(&amp;quot;UserId: johnm&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    fmMain.setCommandListener(this);   &lt;br /&gt;
  }&lt;br /&gt;
  // Called by application manager to start the MIDlet.&lt;br /&gt;
  public void startApp()&lt;br /&gt;
  {&lt;br /&gt;
    display.setCurrent(fmMain);&lt;br /&gt;
  }&lt;br /&gt;
  public void pauseApp()&lt;br /&gt;
  { }&lt;br /&gt;
  &lt;br /&gt;
  public void destroyApp(boolean unconditional)&lt;br /&gt;
  { }&lt;br /&gt;
  public void commandAction(Command c, Displayable s)&lt;br /&gt;
  {&lt;br /&gt;
    if (c == cmNext)&lt;br /&gt;
    {&lt;br /&gt;
      if (count++ == 0)&lt;br /&gt;
      {&lt;br /&gt;
        //--------------------------------&lt;br /&gt;
        // Option # 1      &lt;br /&gt;
        // First time through this method&lt;br /&gt;
        //--------------------------------&lt;br /&gt;
         StringItem tmpItem = (StringItem) fmMain.get(msgIndex);&lt;br /&gt;
         System.out.println(&amp;quot;tmpItem.getLabel(): &amp;quot; + tmpItem.getLabel());&lt;br /&gt;
         System.out.println(&amp;quot;tmpItem.getText(): &amp;quot; + tmpItem.getText());         &lt;br /&gt;
         tmpItem.setLabel(&amp;quot;Account #: &amp;quot;);  //inherited from Item class&lt;br /&gt;
         tmpItem.setText(&amp;quot;731&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        //--------------------------------&lt;br /&gt;
        // Option # 2      &lt;br /&gt;
        // Second time through this method&lt;br /&gt;
        //--------------------------------&lt;br /&gt;
         fmMain.set(msgIndex, new StringItem(&amp;quot;Password: &amp;quot;, &amp;quot;superPants&amp;quot;));&lt;br /&gt;
        &lt;br /&gt;
        // Remove the Update command&lt;br /&gt;
        fmMain.removeCommand(cmNext);&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    else if (c == cmExit)&lt;br /&gt;
    {&lt;br /&gt;
      destroyApp(false);&lt;br /&gt;
      notifyDestroyed();&lt;br /&gt;
    } &lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== StringItem Demo ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
//jad file (please verify the jar size)&lt;br /&gt;
/*&lt;br /&gt;
MIDlet-Name: StringItemExample&lt;br /&gt;
MIDlet-Version: 1.0&lt;br /&gt;
MIDlet-Vendor: MyCompany&lt;br /&gt;
MIDlet-Jar-URL: StringItemExample.jar&lt;br /&gt;
MIDlet-1: StringItemExample, , StringItemExample&lt;br /&gt;
MicroEdition-Configuration: CLDC-1.0&lt;br /&gt;
MicroEdition-Profile: MIDP-1.0&lt;br /&gt;
MIDlet-JAR-SIZE: 100&lt;br /&gt;
*/&lt;br /&gt;
import javax.microedition.lcdui.rumand;&lt;br /&gt;
import javax.microedition.lcdui.rumandListener;&lt;br /&gt;
import javax.microedition.lcdui.Display;&lt;br /&gt;
import javax.microedition.lcdui.Displayable;&lt;br /&gt;
import javax.microedition.lcdui.Form;&lt;br /&gt;
import javax.microedition.lcdui.StringItem;&lt;br /&gt;
import javax.microedition.midlet.MIDlet;&lt;br /&gt;
public class StringItemExample extends MIDlet implements CommandListener {&lt;br /&gt;
  private Display display;&lt;br /&gt;
  private Form form = new Form(&amp;quot;Quiz&amp;quot;);&lt;br /&gt;
  private StringItem question = new StringItem(&amp;quot;Question: &amp;quot;, &amp;quot;A question?&amp;quot;);&lt;br /&gt;
  private Command giveup = new Command(&amp;quot;Give Up&amp;quot;, Command.SCREEN, 1);&lt;br /&gt;
  private Command exit = new Command(&amp;quot;Exit&amp;quot;, Command.EXIT, 1);&lt;br /&gt;
  public StringItemExample() {&lt;br /&gt;
    display = Display.getDisplay(this);&lt;br /&gt;
    form.addCommand(exit);&lt;br /&gt;
    form.addCommand(giveup);&lt;br /&gt;
    form.append(question);&lt;br /&gt;
    form.setCommandListener(this);&lt;br /&gt;
  }&lt;br /&gt;
  public void startApp() {&lt;br /&gt;
    display.setCurrent(form);&lt;br /&gt;
  }&lt;br /&gt;
  public void pauseApp() {&lt;br /&gt;
  }&lt;br /&gt;
  public void destroyApp(boolean unconditional) {&lt;br /&gt;
  }&lt;br /&gt;
  public void commandAction(Command command, Displayable displayable) {&lt;br /&gt;
    if (command == giveup) {&lt;br /&gt;
      question.setLabel(&amp;quot;Answer: &amp;quot;);&lt;br /&gt;
      question.setText(&amp;quot;ans.&amp;quot;);&lt;br /&gt;
      form.removeCommand(giveup);&lt;br /&gt;
    } else if (command == exit) {&lt;br /&gt;
      destroyApp(false);&lt;br /&gt;
      notifyDestroyed();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>