DCT Lightfoot v3 API specification

javax.microedition.lcdui
Class List

java.lang.Object
  |
  +--javax.microedition.lcdui.Displayable
        |
        +--javax.microedition.lcdui.Screen
              |
              +--javax.microedition.lcdui.List
All Implemented Interfaces:
Choice

public class List
extends Screen
implements Choice

The list is a screen that contains a list of choices.


Nested Class Summary
protected  class List.Peer
          Peer class that does the drawing
 
Field Summary
static Command SELECT_COMMAND
          The select command
 
Fields inherited from class javax.microedition.lcdui.Screen
height, offset
 
Fields inherited from class javax.microedition.lcdui.Displayable
display
 
Fields inherited from interface javax.microedition.lcdui.Choice
EXCLUSIVE, IMPLICIT, MULTIPLE
 
Constructor Summary
List(java.lang.String title, int type)
          Create a new list
List(java.lang.String title, int type, java.lang.String[] strings, Image[] images)
          Create a new list specifying the contents of the list
 
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
 
Methods inherited from class javax.microedition.lcdui.Screen
getTicker, getTitle, scrollDown, scrollUp, 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

SELECT_COMMAND

public static final Command SELECT_COMMAND
The select command

Constructor Detail

List

public List(java.lang.String title,
            int type)
Create a new list

Parameters:
title - The title
type - The list type
Throws:
IllegalArgumentException - if the type is not IMPLICIT, EXCLUSIVE or MULTIPLE

List

public List(java.lang.String title,
            int type,
            java.lang.String[] strings,
            Image[] images)
Create a new list specifying the contents of the list

Parameters:
title - The title
type - The list type
strings - The strings to display
images - The images to display
Throws:
NullPointerException - if strings is null
NullPointerException - if any of the strings is null
IllegalArgumentsException - if the images array is not null and has a different length from the strings array
IllegalArgumentException - if the type is not IMPLICIT, EXCLUSIVE or MULTIPLE
IllegalArgumentException - if any image is multable
Method Detail

append

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

Specified by:
append in interface 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

Specified by:
delete in interface Choice
Parameters:
pos - The position
Throws:
IndexOutOfBoundsException - if the element is invalid

getImage

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

Specified by:
getImage in interface Choice
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

Specified by:
getSelectedFlags in interface Choice
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

Specified by:
getSelectedIndex in interface Choice
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

Specified by:
getString in interface Choice
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

Specified by:
insert in interface Choice
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

Specified by:
isSelected in interface Choice
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

Specified by:
set in interface Choice
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

Specified by:
setSelectedFlags in interface Choice
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

Specified by:
setSelectedIndex in interface Choice
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

Specified by:
size in interface Choice
Returns:
the size

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification