|
MID Profile | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.lcdui.Item | +--javax.microedition.lcdui.ChoiceGroup
A ChoiceGroup is a group of selectable elements intended to be
placed within a
Form
. The group may be created with a mode that requires a
single choice to be made or that allows multiple choices. The
implementation is responsible for providing the graphical representation of
these modes and must provide visually different graphics for different
modes. For example, it might use "radio buttons" for the single choice
mode and "check boxes" for the multiple choice mode.
Note: most of the essential methods have been documented in
interface Choice
.
When a ChoiceGroup 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 either when user does the select operation
of some application defined Command
is fired.
When
this occurs a high-level event is delivered to the List's listener.
The event delivery is done with
commandAction
.
Also ItemStateListener
is called
when the user changes the selection state of the ChoiceGroup.
At this time the application can query the ChoiceGroup for information
about the currently selected element(s).
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.
Fields inherited from interface javax.microedition.lcdui.Choice |
EXCLUSIVE,
IMPLICIT,
MULTIPLE |
Constructor Summary | |
ChoiceGroup(String label,
int choiceType)
Creates a new, empty ChoiceGroup, specifying its title and its type. |
|
ChoiceGroup(String label,
int choiceType,
String[] stringElements,
Image[] imageElements)
Creates a new ChoiceGroup, specifying its title, its type, and arrays 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 getString of interface Choice . |
String |
getString(int elementNum)
Implementation of getString of interface Choice . |
void |
insertElement(int elementNum,
String stringElement,
Image imageElement)
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.Item |
getLabel,
setLabel |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ChoiceGroup(String label, int choiceType)
label
- the label {@see javax.microedition.lcdui.Item}choiceType
- either EXCLUSIVE or MULTIPLEChoice.EXCLUSIVE
,
Choice.MULTIPLE
,
Choice.IMPLICIT
public ChoiceGroup(String label, int choiceType, String[] stringElements, Image[] imageElements)
label
- the label {@see javax.microedition.lcdui.Item}choiceType
- either EXCLUSIVE or MULTIPLEstringElements
- set of strings specifying the visible representation of
the elements. Empty String is marked with null and if no strings are given,
whole list is empty (null).imageElements
- set of images specifying the visible representation of
the elements. Empty image is marked with null and if no images are given,
whole list is empty (null).createImage(width, height)
Choice.EXCLUSIVE
,
Choice.MULTIPLE
,
Choice.IMPLICIT
Method Detail |
public int getSize()
getString 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)
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 stringElement, Image imageElement)
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.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 |