|
MID Profile | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.lcdui.Displayable | +--javax.microedition.lcdui.Screen | +--javax.microedition.lcdui.List
The List class is a Screen containing list of choices.
Most of the behavior is common with class
ChoiceGroup
and the common API
is defined in interface Choice
.
When a List is present on the display the user can interact with it
indefinitely (for instance, traversing from element to element
and possibly
scrolling). These traversing and scrolling operations do not cause
application-visible events. The system notifies
the application when some
Command
is fired.
The notification of the application is done with
commandAction
.
List, like any Choice, utilizes a dedicated "select" or "go" functionality of the devices. Typically, the select functionality is distinct from the soft-buttons, but some devices may use soft-buttons for the select. In any case, it is assumed that the select key does not have application-programmable label.
In respect to select functionality here are three types of Lists:
CommandListener
registered.
An implicit selectCommand
is a parameter
for the notification.IMPLICIT List can be used to construct menus by placing logical commands
to elements. In this case no application defined Commands
have to be attached. Application just has to register a CommandListener
that is called when user "selects".
Another use might be a Screen with a default command. For example, the List may contain email headers, and the following Commands:
If the list of type IMPLICIT, the select operation also calls the
method commandAction
with parameter selectCommand
. The implementation of
commandAction() can now do the obvious thing and start the read operation.
It should be noted that this kind of default operation must be used carefully and the usability of the resulting user interface must always kept in mind.
The application can also set the currently selected element(s) prior to displaying the List.
The implementation may have keyboard shortcuts for focusing and selecting the choice elements, but the use of these shortcuts is not visible to the application program.
Note: Many of the essential methods have been documented in
interface Choice
.
Field Summary | |
static Command |
selectCommand
selectCommand is a special command that commandAction
can use to recognize the user did the select operation on a IMPLICIT
List. |
Fields inherited from interface javax.microedition.lcdui.Choice |
EXCLUSIVE,
IMPLICIT,
MULTIPLE |
Constructor Summary | |
List(String title,
int listType)
Creates a new, empty List, specifying its title and the type of the list. |
|
List(String title,
int listType,
String[] stringElements,
Image[] imageElements)
Creates a new List, specifying its title, the type of the List, and an array of Strings and Images to be used as its initial contents. |
Method Summary | |
int |
appendElement(String stringPart,
Image imagePart)
Implementation of appendElement of interface Choice . |
void |
deleteElement(int elementNum)
Implementation of deleteElement of interface Choice . |
Image |
getImage(int elementNum)
Implementation of getImage of interface Choice . |
int |
getSelectedFlags(boolean[] selectedArray_return)
Implementation of getSelectedFlags of interface Choice . |
int |
getSelectedIndex()
Implementation of getSelectedIndex of interface Choice . |
int |
getSize()
Implementation of getSize of interface Choice . |
String |
getString(int elementNum)
Implementation of getString of interface Choice . |
void |
insertElement(int elementNum,
String stringPart,
Image imagePart)
Implementation of insertElement of interface Choice . |
boolean |
isSelected(int elementNum)
Implementation of isSelected of interface Choice . |
void |
setElement(int elementNum,
String stringPart,
Image imagePart)
Implementation of setElement of interface Choice . |
void |
setSelectedFlags(boolean[] selectedArray)
Implementation of setSelectedFlags of interface Choice . |
void |
setSelectedIndex(int elementNum,
boolean selected)
Implementation of getSelectedIndex of interface Choice . |
Methods inherited from class javax.microedition.lcdui.Screen |
getTicker,
getTitle,
setTicker,
setTitle |
Methods inherited from class javax.microedition.lcdui.Displayable |
addCommand,
isShown,
removeCommand,
setListener |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final Command selectCommand
commandAction
can use to recognize the user did the select operation on a IMPLICIT
List.Constructor Detail |
public List(String title, int listType)
title
- the screen title (See Screen
}listType
- one of IMPLICIT, EXCLUSIVE, or MULTIPLEChoice
public List(String title, int listType, String[] stringElements, Image[] imageElements)
title
- the screen title {@see Screen}listType
- one of IMPLICIT, EXCLUSIVE, or MULTIPLEstringElements
- set of strings specifying the visible representation
of the elements.imageElements
- set of images specifying the visible representation of
the elements. Empty image is marked with null, and if no images are
given, the parameter imageElements may be null..Choice.EXCLUSIVE
,
Choice.MULTIPLE
,
Choice.IMPLICIT
Method Detail |
public int getSize()
getSize of interface Choice
.public String getString(int elementNum)
getString of interface Choice
.elementNum
- the number of the elementgetImage(int)
public Image getImage(int elementNum)
getImage of interface Choice
.elementNum
- the number of the elementgetString(int)
,
getString(int)
public int appendElement(String stringPart, Image imagePart)
appendElement of interface Choice
.stringPart
- the string part of the element to be addedimagePart
- the image part of the element to be added, or null if
there is no image partpublic void insertElement(int elementNum, String stringPart, Image imagePart)
insertElement of interface Choice
.elementNum
- the number of the elementstringPart
- the string part of the element to be insertedimagePart
- the image part of the element to be inserted,
or null if there is no image partpublic void deleteElement(int elementNum)
deleteElement of interface Choice
.elementNum
- the number of the element to be deletedpublic void setElement(int elementNum, String stringPart, Image imagePart)
setElement of interface Choice
.elementNum
- the number of the elementstringPart
- the string part of the new elementimagePart
- the image part of the element, or null if there is
no image partpublic boolean isSelected(int elementNum)
isSelected of interface Choice
.elementNum
- index to element of interestpublic int getSelectedIndex()
getSelectedIndex of interface Choice
.public int getSelectedFlags(boolean[] selectedArray_return)
getSelectedFlags of interface Choice
.selectedArray_return
- array to contain the results.
It must be at least as long as the size
of the List as returned by getSize().
If the array is longer, the extra
elements are set to false.public void setSelectedIndex(int elementNum, boolean selected)
getSelectedIndex of interface Choice
.elementNum
- the number of the element. Indexing of the elements is zero-based.selected
- the new state of the element true=selected, false=not selected.public void setSelectedFlags(boolean[] selectedArray)
setSelectedFlags of interface Choice
.selectedArray
- an array in which the method collect the selection status
|
MID Profile | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |