|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Item
javax.microedition.lcdui.CustomItem
de.enough.polish.ui.FakeCustomItem
de.enough.polish.ui.FakeContainerCustomItem
de.enough.polish.ui.FakeChoiceGroupCustomItem
public class FakeChoiceGroupCustomItem
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
specified in the Choice interface.
| Field Summary | |
|---|---|
static javax.microedition.lcdui.Command |
MARK_COMMAND
|
static javax.microedition.lcdui.Command |
UNMARK_COMMAND
|
| Fields inherited from class de.enough.polish.ui.FakeContainerCustomItem |
|---|
allowCycling, autoFocusEnabled, autoFocusIndex, availableHeight, containerView, enableScrolling, focusedIndex, focusedItem, focusedStyleFirst, focusedStyleLast, isExpandItems, itemsList, itemStyle, lastPointerPressY, plainStyle, SCROLL_DEFAULT, SCROLL_SMOOTH, scrollSmooth, targetYOffset, yOffset |
| Fields inherited from class javax.microedition.lcdui.CustomItem |
|---|
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL |
| Fields inherited from interface de.enough.polish.ui.Choice |
|---|
EXCLUSIVE, IMPLICIT, MULTIPLE, POPUP, TEXT_WRAP_DEFAULT, TEXT_WRAP_OFF, TEXT_WRAP_ON |
| Constructor Summary | |
|---|---|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType)
Creates a new, empty ChoiceGroup, specifying its
title and its type. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
ChoiceItem[] items)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
ChoiceItem[] items,
Style style)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
ChoiceItem[] items,
Style style,
boolean allowImplicit)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements,
Style style)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements,
Style style,
boolean allowImplicit)
Creates a new ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents. |
|
FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
Style style)
Creates a new, empty ChoiceGroup, specifying its
title and its type. |
|
| Method Summary | |
|---|---|
int |
append(ChoiceItem item)
Appends a ChoiceItem to this choice group. |
int |
append(ChoiceItem item,
Style elementStyle)
Appends a ChoiceItem to this choice group. |
int |
append(java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart)
Appends an element to the ChoiceGroup. |
int |
append(java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart,
Style elementStyle)
Appends an element to the ChoiceGroup. |
protected static ChoiceItem[] |
buildChoiceItems(java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements,
int choiceType,
Style style)
Builds an array of ChoiceItems out of
an array of Strings and Images,
specifying the choiceType and style
common to any ChoiceItem in the resulting array. |
void |
commandAction(javax.microedition.lcdui.Command c,
Item item)
Called by the system to indicate that a command has been invoked on a particular item. |
protected java.lang.String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected javax.microedition.lcdui.Image |
createPopupImage()
Creates or returns the default image for popup groups. |
void |
defocus(Style originalStyle)
Removes the focus from this item. |
void |
delete(int elementNum)
Deletes the element referenced by elementNum. |
void |
deleteAll()
Deletes all elements from this ChoiceGroup. |
protected Style |
focus(Style focusStyle,
int direction)
Focuses this item. |
int |
getFitPolicy()
Gets the application's preferred policy for fitting Choice element contents to the available screen space. |
javax.microedition.lcdui.Font |
getFont(int elementNum)
Gets the application's preferred font for rendering the specified element of this Choice. |
javax.microedition.lcdui.Image |
getImage(int elementNum)
Gets the Image part of the element referenced by
elementNum. |
ChoiceItem |
getItem(int elementNum)
Gets the ChoiceItem of the element referenced by
elementNum. |
int |
getSelectedFlags(boolean[] selectedArray_return)
Queries the state of a ChoiceGroup and returns the state of
all elements in the
boolean array
selectedArray_return. |
int |
getSelectedIndex()
Returns the index number of an element in the ChoiceGroup that is
selected. |
java.lang.String |
getString(int elementNum)
Gets the String part of the element referenced by
elementNum. |
protected boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the key-pressed event. |
protected boolean |
handlePointerPressed(int relX,
int relY)
Handles the event when a pointer has been pressed at the specified position. |
protected void |
hideNotify()
Called by the system to notify the item that it is now completely invisible, when it previously had been at least partially visible. |
protected void |
init(int firstLineWidth,
int lineWidth)
Initialises this item. |
protected void |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
void |
insert(int elementNum,
ChoiceItem item)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
void |
insert(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
void |
insert(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart,
Style elementStyle)
Inserts an element into the ChoiceGroup just prior to
the element specified. |
boolean |
isInContentArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's content area. |
boolean |
isInItemArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's area including paddings, margins and label. |
boolean |
isPopupClosed()
|
boolean |
isSelected(int elementNum)
Gets a boolean value indicating whether this element is selected. |
void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
void |
set(int elementNum,
ChoiceItem item)
Sets the ChoiceItem of the
element referenced by elementNum,
replacing the previous one. |
void |
set(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart)
Sets the String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element. |
void |
set(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart,
Style elementStyle)
Sets the String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element. |
void |
setDefaultCommand(javax.microedition.lcdui.Command cmd)
Sets the command for selecting this (and opening this POPUP) choicegroup. |
void |
setFitPolicy(int fitPolicy)
Sets the application's preferred policy for fitting Choice element contents to the available screen space. |
void |
setFont(int elementNum,
javax.microedition.lcdui.Font font)
Sets the application's preferred font for rendering the specified element of this Choice. |
void |
setItemCommandListener(ItemCommandListener l)
Sets a listener for Commands to this Item,
replacing any previous
ItemCommandListener. |
protected void |
setSelectCommand(javax.microedition.lcdui.Command command)
Sets the select command for this choice group. |
void |
setSelectedFlags(boolean[] selectedArray)
Attempts to set the selected state of every element in the ChoiceGroup. |
void |
setSelectedIndex(int elementNum,
boolean selected)
For ChoiceGroup objects of type
MULTIPLE, this simply sets an
individual element's selected state. |
void |
setStyle(Style style,
boolean ignoreBackground)
Sets the style of this container. |
| Methods inherited from class javax.microedition.lcdui.CustomItem |
|---|
getGameAction, getInteractionModes, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, sizeChanged, traverse, traverseOut |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface de.enough.polish.ui.Choice |
|---|
size |
| Field Detail |
|---|
public static javax.microedition.lcdui.Command MARK_COMMAND
public static javax.microedition.lcdui.Command UNMARK_COMMAND
| Constructor Detail |
|---|
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType)
ChoiceGroup, specifying its
title and its type.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
choice type is not allowed within a ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUP
java.lang.IllegalArgumentException - - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
Style style)
ChoiceGroup, specifying its
title and its type.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
choice type is not allowed within a ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstyle - the CSS style for this item
java.lang.IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
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 ChoiceGroup. The
imageElements array
may be null to indicate that the
ChoiceGroup 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 ChoiceGroup element. Non-null elements
of the
imageElements array may refer to mutable or
immutable images.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elements
java.lang.NullPointerException - if stringElements is null or if the stringElements array contains any null elements
java.lang.IllegalArgumentException - if the imageElements array is non-null and has a different length from the stringElements array
or if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements,
Style style)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
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 ChoiceGroup. The
imageElements array
may be null to indicate that the
ChoiceGroup 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 ChoiceGroup element. Non-null elements
of the
imageElements array may refer to mutable or
immutable images.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elementsstyle - The CSS style for this item
java.lang.NullPointerException - if stringElements is null or if the stringElements array contains any null elements
java.lang.IllegalArgumentException - if the imageElements array is non-null and has a different length from the stringElements array
or if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUPChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements,
Style style,
boolean allowImplicit)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of Strings
and Images to be used as its
initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
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 ChoiceGroup. The
imageElements array
may be null to indicate that the
ChoiceGroup 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 ChoiceGroup element. Non-null elements
of the
imageElements array may refer to mutable or
immutable images.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPstringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elementsstyle - The CSS style for this itemallowImplicit - true when the Choice.IMPLICIT choiceType is also allowed
java.lang.NullPointerException - if stringElements is null or if the stringElements array contains any null elements
java.lang.IllegalArgumentException - if the imageElements array is non-null and has a different length from the stringElements array
or if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
ChoiceItem[] items)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The itemss array must be non-null and
every ChoiceItem must have its text be a non-null
String.
The length of the items array
determines the number of elements in the ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPitems - set of ChoiceItems specifying the ChoiceGroup elements
java.lang.NullPointerException - if items is null
or if getText() for one of the ChoiceItem in the array
retuns a null String.
java.lang.IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
ChoiceItem[] items,
Style style)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The itemss array must be non-null and
every ChoiceItem must have its text be a non-null
String.
The length of the items array
determines the number of elements in the ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPitems - set of ChoiceItems specifying the ChoiceGroup elementsstyle - The CSS style for this item
java.lang.NullPointerException - if items is null
or if getText() for one of the ChoiceItem in the array
retuns a null String.
java.lang.IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP
public FakeChoiceGroupCustomItem(java.lang.String label,
int choiceType,
ChoiceItem[] items,
Style style,
boolean allowImplicit)
ChoiceGroup, specifying its title,
the type of the
ChoiceGroup, and an array of ChoiceItems
to be used as its initial contents.
The type must be one of EXCLUSIVE,
MULTIPLE, or POPUP. The
IMPLICIT
type is not allowed for ChoiceGroup.
The itemss array must be non-null and
every ChoiceItem must have its text be a non-null
String.
The length of the items array
determines the number of elements in the ChoiceGroup.
label - the item's label (see Item)choiceType - EXCLUSIVE, MULTIPLE, or POPUPitems - set of ChoiceItems specifying the ChoiceGroup elementsstyle - The CSS style for this itemallowImplicit - true when the Choice.IMPLICIT choiceType is also allowed
java.lang.IllegalArgumentException - if choiceType is not one of EXCLUSIVE, MULTIPLE, or POPUP (unless allowImplicit is defined)Choice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUP| Method Detail |
|---|
protected static ChoiceItem[] buildChoiceItems(java.lang.String[] stringElements,
javax.microedition.lcdui.Image[] imageElements,
int choiceType,
Style style)
ChoiceItems out of
an array of Strings and Images,
specifying the choiceType and style
common to any ChoiceItem in the resulting array.
stringElements - set of strings specifying the string parts of the ChoiceGroup elementsimageElements - set of images specifying the image parts of the ChoiceGroup elementschoiceType - EXCLUSIVE, MULTIPLE, or POPUPstyle - The CSS style for this item
java.lang.NullPointerException - if stringElements is null or if the stringElements array contains any null elements
java.lang.IllegalArgumentException - if the imageElements array is non-null and has a different length from the stringElements arrayChoice.EXCLUSIVE,
Choice.MULTIPLE,
Choice.IMPLICIT,
Choice.POPUPprotected javax.microedition.lcdui.Image createPopupImage()
public java.lang.String getString(int elementNum)
String part of the element referenced by
elementNum.
getString in interface ChoiceelementNum - the index of the element to be queried
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getImage(int)public javax.microedition.lcdui.Image getImage(int elementNum)
Image part of the element referenced by
elementNum.
getImage in interface ChoiceelementNum - the number of the element to be queried
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getString(int)public ChoiceItem getItem(int elementNum)
ChoiceItem of the element referenced by
elementNum.
elementNum - the number of the element to be queried
java.lang.IndexOutOfBoundsException - if elementNum is invalid
public int append(java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart)
ChoiceGroup.
append in interface ChoicestringPart - 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 part
java.lang.NullPointerException - if stringPart is nullin interface Choice
public int append(java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart,
Style elementStyle)
ChoiceGroup.
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 partelementStyle - the style for the appended ChoiceItem
java.lang.NullPointerException - if stringPart is nullin interface Choicepublic int append(ChoiceItem item)
item - the item
public int append(ChoiceItem item,
Style elementStyle)
item - the itemelementStyle - the style of the item, ignored when null
public void insert(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart)
ChoiceGroup just prior to
the element specified.
insert in interface ChoiceelementNum - the index of the element where insertion is to occurstringPart - 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 part
java.lang.IndexOutOfBoundsException - if elementNum is invalid
java.lang.NullPointerException - if stringPart is nullin interface Choice
public void insert(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart,
Style elementStyle)
ChoiceGroup just prior to
the element specified.
elementNum - the index of the element where insertion is to occurstringPart - 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 partelementStyle - the style for the inserted ChoiceItem
java.lang.IndexOutOfBoundsException - if elementNum is invalid
java.lang.NullPointerException - if stringPart is nullin interface Choice
public void insert(int elementNum,
ChoiceItem item)
ChoiceGroup just prior to
the element specified.
elementNum - the index of the element where insertion is to occuritem - ChoiceItem of the element to be inserted
java.lang.IndexOutOfBoundsException - if elementNum is invalid
public void set(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart)
String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element.
set in interface ChoiceelementNum - - the index of the element to be setstringPart - - the string part of the new elementimagePart - - the image part of the element, or null if there is no image part
java.lang.IndexOutOfBoundsException - - if elementNum is invalid
java.lang.NullPointerException - - if stringPart is nullin interface Choice
public void set(int elementNum,
java.lang.String stringPart,
javax.microedition.lcdui.Image imagePart,
Style elementStyle)
String and Image parts of the
element referenced by elementNum,
replacing the previous contents of the element.
elementNum - the index of the element to be setstringPart - the string part of the new elementimagePart - the image part of the element, or null if there is no image partelementStyle - the style for the new list element.
java.lang.IndexOutOfBoundsException - if elementNum is invalid
java.lang.NullPointerException - if stringPart is nullin interface Choice
public void set(int elementNum,
ChoiceItem item)
ChoiceItem of the
element referenced by elementNum,
replacing the previous one.
elementNum - the index of the element to be setitem - the ChoiceItem of the new element
java.lang.IndexOutOfBoundsException - if elementNum is invalidpublic void delete(int elementNum)
elementNum.
delete in interface ChoiceelementNum - the index of the element to be deleted
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choicepublic void deleteAll()
ChoiceGroup.
deleteAll in interface Choicein interface Choicepublic boolean isSelected(int elementNum)
isSelected in interface ChoiceelementNum - the index of the element to be queried
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choicepublic int getSelectedIndex()
ChoiceGroup that is
selected. For ChoiceGroup objects of type
EXCLUSIVE and POPUP
there is at most one element selected, so
this method is useful for determining the user's choice.
Returns -1 if
there are no elements in the ChoiceGroup.
For ChoiceGroup objects of type
MULTIPLE, this always
returns -1 because no
single value can in general represent the state of such a
ChoiceGroup.
To get the complete state of a MULTIPLE
Choice, see getSelectedFlags.
getSelectedIndex in interface Choicein interface Choice,
setSelectedIndex(int, boolean)public int getSelectedFlags(boolean[] selectedArray_return)
ChoiceGroup and returns the state of
all elements in the
boolean array
selectedArray_return. Note: this
is a result parameter.
It must be at least as long as the size
of the ChoiceGroup as returned by size().
If the array is longer, the extra
elements are set to false.
For ChoiceGroup objects of type
MULTIPLE, any
number of elements may be selected and set to true in the result
array. For ChoiceGroup objects of type
EXCLUSIVE and POPUP
exactly one element will be selected, unless there are
zero elements in the ChoiceGroup.
getSelectedFlags in interface ChoiceselectedArray_return - array to contain the results
java.lang.IllegalArgumentException - if selectedArray_return is shorter than the size of the ChoiceGroup
java.lang.NullPointerException - if selectedArray_return is nullin interface Choice,
setSelectedFlags(boolean[])
public void setSelectedIndex(int elementNum,
boolean selected)
ChoiceGroup objects of type
MULTIPLE, this simply sets an
individual element's selected state.
For ChoiceGroup objects of type
EXCLUSIVE and POPUP, this can be used only to
select an element. That is, the selected parameter must
be true . When an element is selected, the previously
selected element is deselected. If selected is
false , this call is ignored.
For both list types, the elementNum parameter
must be within
the range
[0..size()-1], inclusive.
setSelectedIndex in interface ChoiceelementNum - the number of the element. Indexing of the elements is zero-basedselected - the new state of the element true=selected, false=not selected
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getSelectedIndex()public void setSelectedFlags(boolean[] selectedArray)
ChoiceGroup. The array
must be at least as long as the size of the
ChoiceGroup. If the array is
longer, the additional values are ignored.
For ChoiceGroup objects of type
MULTIPLE, this sets the selected
state of every
element in the Choice. An arbitrary number of
elements may be selected.
For ChoiceGroup objects of type
EXCLUSIVE and POPUP, exactly one array
element must have the value true. If no element is
true,
the first element
in the Choice will be selected. If two or more
elements are true, the
implementation will choose the first true element
and select it.
setSelectedFlags in interface ChoiceselectedArray - an array in which the method collect the selection status
java.lang.IllegalArgumentException - if selectedArray is shorter than the size of the ChoiceGroup
java.lang.NullPointerException - if the selectedArray is nullin interface Choice,
getSelectedFlags(boolean[])public void setFitPolicy(int fitPolicy)
Choice element contents to the available screen space. The set policy applies for all
elements of the Choice object. Valid values are
Choice.TEXT_WRAP_DEFAULT,
Choice.TEXT_WRAP_ON,
and Choice.TEXT_WRAP_OFF.
Fit policy is a hint, and the
implementation may disregard the application's preferred policy.
The J2ME Polish implementation always uses the TEXT_WRAP_ON policy.
setFitPolicy in interface ChoicefitPolicy - preferred content fit policy for choice elementsin interface Choice,
getFitPolicy()public int getFitPolicy()
Choice element contents to the available screen space. The value returned is the
policy that had been set by the application, even if that value had
been disregarded by the implementation.
getFitPolicy in interface Choicein interface Choice,
setFitPolicy(int)
public void setFont(int elementNum,
javax.microedition.lcdui.Font font)
Choice.
An element's font is a hint, and the implementation may disregard
the application's preferred font.
The J2ME Polish implementation uses the font defined by the appropriate
CSS style and ignores the font which is set here.
setFont in interface ChoiceelementNum - the index of the element, starting from zerofont - the preferred font to use to render the element
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
getFont(int)public javax.microedition.lcdui.Font getFont(int elementNum)
Choice. The
value returned is the font that had been set by the application,
even if that value had been disregarded by the implementation.
If no font had been set by the application, or if the application
explicitly set the font to null, the value is the default
font chosen by the implementation.
The elementNum parameter must be within the range
[0..size()-1], inclusive.
getFont in interface ChoiceelementNum - the index of the element, starting from zero
java.lang.IndexOutOfBoundsException - if elementNum is invalidin interface Choice,
setFont(int elementNum, Font font)protected void hideNotify()
FakeContainerCustomItempaint() calls will be made on this item
until after a showNotify() has been called again.
The container implementation calls hideNotify() on the embedded items.
hideNotify in class FakeContainerCustomItem
public void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
FakeCustomItem
paintContent in class FakeContainerCustomItemx - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.
protected void init(int firstLineWidth,
int lineWidth)
FakeCustomItem
init in class FakeCustomItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesFakeCustomItem.initContent(int, int),
ItemView.initContent(Item, int, int)
protected void initContent(int firstLineWidth,
int lineWidth)
FakeCustomItem
initContent in class FakeContainerCustomItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesFakeCustomItem.contentWidth,
FakeCustomItem.contentHeight,
FakeCustomItem.preferredWidth,
FakeCustomItem.preferredHeightprotected java.lang.String createCssSelector()
FakeCustomItem
createCssSelector in class FakeContainerCustomItempublic boolean isPopupClosed()
protected boolean handleKeyPressed(int keyCode,
int gameAction)
FakeCustomItem
handleKeyPressed in class FakeContainerCustomItemkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handlePointerPressed(int relX,
int relY)
FakeCustomItem
handlePointerPressed in class FakeContainerCustomItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
FakeCustomItem.handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
public boolean isInContentArea(int relX,
int relY)
FakeCustomItem
isInContentArea in class FakeCustomItemrelX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
FakeCustomItem.initContent(int, int)
public boolean isInItemArea(int relX,
int relY)
FakeCustomItem
isInItemArea in class FakeCustomItemrelX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
FakeCustomItem.initContent(int, int)protected void setSelectCommand(javax.microedition.lcdui.Command command)
command - the new select commandpublic void setDefaultCommand(javax.microedition.lcdui.Command cmd)