|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.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 SELECT_COMMAND
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 SELECT_COMMAND
. 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 |
SELECT_COMMAND
SELECT_COMMAND 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 |
append(String stringElement,
Image imageElement)
Implementation of appendElement of interface Choice . |
void |
delete(int index)
Implementation of deleteElement of interface Choice . |
Image |
getImage(int index)
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 . |
String |
getString(int index)
Implementation of getString of interface Choice . |
void |
insert(int index,
String stringElement,
Image imageElement)
Implementation of insertElement of interface Choice . |
boolean |
isSelected(int index)
Implementation of isSelected of interface Choice . |
void |
set(int index,
String stringElement,
Image imageElement)
Implementation of setElement of interface Choice . |
void |
setSelectedFlags(boolean[] selectedArray)
Implementation of setSelectedFlags of interface Choice . |
void |
setSelectedIndex(int index,
boolean selected)
Implementation of getSelectedIndex of interface Choice . |
int |
size()
Implementation of getSize 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, setCommandListener |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Command SELECT_COMMAND
commandAction
can use to recognize the user did the select operation on a IMPLICIT
List. The field values of SELECT_COMMAND are:
Constructor Detail |
public List(String title, int listType)
Creates a new, empty List, specifying its title and the type of the list.
title
- the screen's title (see Screen
)listType
- one of IMPLICIT, EXCLUSIVE, or MULTIPLE
IllegalArgumentException
- if listType is not one of IMPLICIT,
EXCLUSIVE, or MULTIPLE.Choice
public 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.
The stringElements array must be non-null and every array element must also be non-null. The length of the stringElements array determines the number of elements in the List. The imageElements array may be null to indicate that the List elements have no images. If the imageElements array is non-null, it must be the same length as the stringElements array. Individual elements of the imageElements array may be null in order to indicate the absence of an image for the corresponding List element.
title
- the screen's title (see Screen
)listType
- one of IMPLICIT, EXCLUSIVE, or MULTIPLEstringElements
- set of strings specifying the string parts of the
List elementsimageElements
- set of images specifying the image parts of
the List elements
NullPointerException
- if stringElements is null
NullPointerException
- if the stringElements array contains
any null elements
IllegalArgumentException
- if the imageElements array is non-null
and has a different length from the stringElements array
IllegalArgumentException
- if listType is not one of IMPLICIT,
EXCLUSIVE, or MULTIPLE.
IllegalArgumentException
- if any image in the imageElements array is mutableChoice.EXCLUSIVE
,
Choice.MULTIPLE
,
Choice.IMPLICIT
Method Detail |
public int size()
getSize of interface Choice
.
size
in interface Choice
public String getString(int index)
getString of interface Choice
.
getString
in interface Choice
index
- The index of the selected item
getImage(int)
public Image getImage(int index)
getImage of interface Choice
.
getImage
in interface Choice
index
- the index of the selected item
getString(int)
public int append(String stringElement, Image imageElement)
appendElement of interface Choice
.
append
in interface Choice
stringElement
- String to be appendedimageElement
- Image to be appended
public void insert(int index, String stringElement, Image imageElement)
insertElement of interface Choice
.
insert
in interface Choice
index
- Index of the item to be insertedstringElement
- String of the item to be insertedimageElement
- Image of the item to be insertedpublic void delete(int index)
deleteElement of interface Choice
.
delete
in interface Choice
index
- Index of the element to be deletedpublic void set(int index, String stringElement, Image imageElement)
setElement of interface Choice
.
set
in interface Choice
index
- Index of element to be set.stringElement
- String entry of element to be set.imageElement
- Image entry of element to be set.public boolean isSelected(int index)
isSelected of interface Choice
.
isSelected
in interface Choice
index
- Index of element to be selected.
public int getSelectedIndex()
getSelectedIndex of interface Choice
.
getSelectedIndex
in interface Choice
public int getSelectedFlags(boolean[] selectedArray_return)
getSelectedFlags of interface Choice
.
getSelectedFlags
in 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 index, boolean selected)
getSelectedIndex of interface Choice
.
setSelectedIndex
in interface Choice
selected
- the new state of the element true=selected, false=not selected.index
- Index of element.public void setSelectedFlags(boolean[] selectedArray)
setSelectedFlags of interface Choice
.
setSelectedFlags
in interface Choice
selectedArray
- an array in which the method collect the selection status
|
![]() |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Generated on 2003-10-17 | For further information and updates, please visit Siemens mobile Developer Portal |