DCT Lightfoot v3 API specification

javax.microedition.lcdui
Interface Choice

All Known Implementing Classes:
ChoiceGroup, List

public interface Choice

This interface allows things to be chosen


Field Summary
static int EXCLUSIVE
          Exclusive selection
static int IMPLICIT
          Implicit selection
static int MULTIPLE
          Multiple selection
 
Method Summary
 int append(java.lang.String string, Image image)
          Append an element to the choice
 void delete(int pos)
          Delete the element at the specified position
 Image getImage(int pos)
          Get the image at the position
 int getSelectedFlags(boolean[] array)
          Return the state of all the selections
 int getSelectedIndex()
          Return the selected items index
 java.lang.String getString(int pos)
          Get the string part of the element at the posiotion
 void insert(int pos, java.lang.String string, Image image)
          Insert a new value before the specified element.
 boolean isSelected(int pos)
          Return true if the item at the position is selected
 void set(int pos, java.lang.String string, Image image)
          Set the element at the specified position to the new string and image
 void setSelectedFlags(boolean[] flags)
          Set the selected state of every element
 void setSelectedIndex(int pos, boolean selected)
          Set the selection state of the item at the specified position
 int size()
          Get the size of the choice
 

Field Detail

EXCLUSIVE

public static final int EXCLUSIVE
Exclusive selection

See Also:
Constant Field Values

IMPLICIT

public static final int IMPLICIT
Implicit selection

See Also:
Constant Field Values

MULTIPLE

public static final int MULTIPLE
Multiple selection

See Also:
Constant Field Values
Method Detail

append

public int append(java.lang.String string,
                  Image image)
Append an element to the choice

Parameters:
string - The string part to append
image - The image part to append
Returns:
the index of the element
Throws:
IllegalArgumentException - if the image is mutable
NullPointerException - if the string is null

delete

public void delete(int pos)
Delete the element at the specified position

Parameters:
pos - The position
Throws:
IndexOutOfBoundsException - if the element is invalid

getImage

public Image getImage(int pos)
Get the image at the position

Parameters:
pos - The position
Returns:
the image
Throws:
IndexOutOfBoundsException - if the element is invalid

getSelectedFlags

public int getSelectedFlags(boolean[] array)
Return the state of all the selections

Returns:
the number of elements
Throws:
IllegalArgumentException - if the array is too short
NullPointerException - if the array is null

getSelectedIndex

public int getSelectedIndex()
Return the selected items index

Returns:
the index or -1 if nothing is selected

getString

public java.lang.String getString(int pos)
Get the string part of the element at the posiotion

Parameters:
pos - The position
Returns:
the string part
Throws:
IndexOutOfBoundsException - if the element is invalid

insert

public void insert(int pos,
                   java.lang.String string,
                   Image image)
Insert a new value before the specified element. The size grows shifing all the other values up

Parameters:
pos - The position to insert in. The current item at that location is moved up
string - The string part to display
image - The image part
Throws:
IndexOutOfBoundsException - if the element is invalid
IllegalArgumentException - if the image is mutable
NullPointerException - if the string is null

isSelected

public boolean isSelected(int pos)
Return true if the item at the position is selected

Parameters:
pos - The position
Returns:
true if it is, false otherwise
Throws:
IndexOutOfBoundsException - if the element is invalid

set

public void set(int pos,
                java.lang.String string,
                Image image)
Set the element at the specified position to the new string and image

Parameters:
pos - The position to set
string - The string part to display
image - The image part
Throws:
IndexOutOfBoundsException - if the element is invalid
IllegalArgumentException - if the image is mutable
NullPointerException - if the string is null

setSelectedFlags

public void setSelectedFlags(boolean[] flags)
Set the selected state of every element

Parameters:
flags - The boolean array containing the selected states
Throws:
IllegalArgumentException - if the array is too short
NullPointerException - if the array is null

setSelectedIndex

public void setSelectedIndex(int pos,
                             boolean selected)
Set the selection state of the item at the specified position

Parameters:
pos - The position
selected - True if it is selected, false otherwise
Throws:
IndexOutOfBoundsException - if the element is invalid

size

public int size()
Get the size of the choice

Returns:
the size

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification