J2ME List Image
List Image MIDlet Example
This example illustrates how to create list with image symbol. In this example we are trying to create list using of List class. The List class define in two type of constructors, that is:
- List(String title, int listType)
- List(String title, int listType, String[] stringElements, Image[] imageElements)
The List class has following Methods:
- append(String stringPart, Image imagePart):- This method is the integer type, which is used to append an element to the choice.
- delete(int elementNum):- This is the void type which deletes the element.
- getImage(int elementNum):- This is the Image type which gets the image.
- getSelectedFlags(boolean[] selectedArray_return):- This is integer type method which has the state of a Choice and returns the state of all elements in the boolean array.
- getSelectedIndex():- This is the integer type which returns the index number of an element in the Choice that is selected.
- getString(int elementNum):- This method is used to get the String of the element.
- insert(int elementNum, String stringPart, Image imagePart):- This is void type it inserts an element into the Choice just prior to the element specified.
- isSelected(int elementNum):- It gets the boolean value indicating whether element is selected or not.
- set(int elementNum, String stringPart, Image imagePart):- It sets the element to the specified element, replacing the previous contents of the element.
- setSelectedFlags(boolean[] selectedArray)
- setSelectedIndex(int elementNum, boolean selected)
- size()
The SELECT_COMMAND is used to recognized whether user select from list or not.
Source Code of ListImage.java
import java.io.IOException;
|