ch.aplu.gidlet
Class MList

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Screen
          extended by javax.microedition.lcdui.List
              extended by ch.aplu.gidlet.MList
All Implemented Interfaces:
javax.microedition.lcdui.Choice

public class MList
extends javax.microedition.lcdui.List

List display with simple input and output items. A soft button 'Exit' is shown. Hitting the corresponding key will call the Gidlet's doExit(). If you do not need this button, invoke removeExitButton().
If you implement your own CommandListener and call setCommandListener(), the internal CommandListener is disabled.
main() serves as entry point for the user programm. It is called in the run-method of a separate thread and should terminate to avoid non-terminated threads.
Creation may take place within main() or while declaring instance variable of the application program.
Example:


 import ch.aplu.gidlet.*;
 import javax.microedition.lcdui.*;

 public class ListSelectGidlet extends Gidlet
 {
   private MList list = new MList("Email");

   public void main()
   {
     list.append("Read", null);
     list.append("Reply", null);
     list.append("Delete", null);
     list.show();
   }

   public void doOk()
   {
     int index = list.getSelectedIndex();
     String selection = list.getString(index);
     showMessage(selection);
   }
 }


Field Summary
 
Fields inherited from class javax.microedition.lcdui.List
SELECT_COMMAND
 
Fields inherited from interface javax.microedition.lcdui.Choice
EXCLUSIVE, IMPLICIT, MULTIPLE, POPUP, TEXT_WRAP_DEFAULT, TEXT_WRAP_OFF, TEXT_WRAP_ON
 
Constructor Summary
MList()
          Constructs a MList with no title and list type IMPLICIT.
MList(java.lang.String title)
          Constructs a MList with given title and list type IMPLICIT.
 
Method Summary
 void addOkButton()
          Adds an OK soft button with label "OK".
 void addOkButton(java.lang.String label)
          Adds an OK soft button with given label.
 void removeExitButton()
          Removes Exit soft button.
 void removeOkButton()
          Removes Ok soft button.
 void show()
          Shows the form display if it is not yet visible or it was previously hidden by another display.
 void show(boolean wait)
          Shows the list display if it is not yet visible or it was previously hidden by another display.
 
Methods inherited from class javax.microedition.lcdui.List
append, delete, deleteAll, getFitPolicy, getFont, getImage, getSelectedFlags, getSelectedIndex, getString, getTicker, insert, isSelected, removeCommand, set, setFitPolicy, setFont, setSelectCommand, setSelectedFlags, setSelectedIndex, setTicker, setTitle, size
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTitle, getWidth, isShown, setCommandListener, sizeChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MList

public MList(java.lang.String title)
Constructs a MList with given title and list type IMPLICIT. The display is initially invisible and should be made visible by calling show(). If an EXCLUSIVE (radio buttons) or MULTIPLE list (check boxes) is needed, use a ChoiceGroup item instead.


MList

public MList()
Constructs a MList with no title and list type IMPLICIT. The display is initially invisible and should be made visible by calling show(). If an EXCLUSIVE (radio buttons) or MULTIPLE list (check boxes) is needed, use a ChoiceGroup item instead.

Method Detail

show

public void show()
Shows the form display if it is not yet visible or it was previously hidden by another display. Because it is not garanteed that the diplay is actually visible when Display.setCurrent() returns, wait for a maximum of 5 s for the display to get shown.


show

public void show(boolean wait)
Shows the list display if it is not yet visible or it was previously hidden by another display. If wait = true, block until the display becomes actually visible, up to a maximum auf 5 seconds. This may be useful to observe the start of an animation.


addOkButton

public void addOkButton()
Adds an OK soft button with label "OK". When pressed, the Gidlet's callback notification doOk() is called unless you register your own CommandListener.


addOkButton

public void addOkButton(java.lang.String label)
Adds an OK soft button with given label. When pressed, the Gidlet's callback notification doOk() is called unless you register your own CommandListener.


removeExitButton

public void removeExitButton()
Removes Exit soft button. Gidlet's callback notification doExit() is disabled.


removeOkButton

public void removeOkButton()
Removes Ok soft button. Gidlet's callback notification doOk() is disabled.