|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Canvas
fds.micro.ui.AbstractPanel
This class implement the basic behaviour for panels that manages components derivated from fds.micro.ui.Component.
It inherits from javax.microedition.lcdui.Canvas. Please see this super-class for generic details.
Warning: Use this class only if you want to have control on rendering. If possible, always prefer javax.microedition.lcdui.Form class.
If you want to write your own container you must respect following rules:
Example of paint() method in fds.micro.ui.AbstractPanel sub-class:
public void paint(Graphics g) { // Layout if necessary if( ! this.layoutDone) { doLayout(); } // Paint components super.paint(g); }
Field Summary |
Fields inherited from class javax.microedition.lcdui.Canvas |
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
Constructor Summary | |
AbstractPanel()
Build an empty panel. |
Method Summary | |
void |
addContainerListener(ContainerListener listener)
Add a listener object that will receive container events produced by this panel. |
void |
append(Component component)
Add a component to the container. |
boolean |
contains(Component component)
Tests if the specified component is a component in this container. |
java.lang.Object |
getComponent(int index)
Gives the component of specified index. |
java.lang.Object[] |
getComponents()
Get components within this container. |
int |
getCount()
Get the number of components in this container. |
int |
getFocusIndex()
Get the index of component that currently have the focus. |
int |
indexOf(Component component)
Searches for the first occurence of the given component, testing for equality using the equals method. |
int |
indexOf(Component component,
int index)
Searches for the first occurence of the given component, beginning the search at index, and testing for equality using the equals method. |
void |
insert(Component component,
int index)
Inserts the specified component as a component in this container at the specified index (paint order). |
boolean |
isEmpty()
Tests if this container has no components. |
int |
lastIndexOf(Component component)
Returns the index of the last occurrence of the specified component in this container. |
int |
lastIndexOf(Component component,
int index)
Returns the index of the last occurrence of the specified component in this container, starting from the specified index. |
void |
remove(int index)
Remove a component from the container. |
void |
removeAll()
Remove all components from the container. |
void |
removeContainerListener(ContainerListener listener)
Remove an container listener. |
Component |
replace(Component component,
int index)
Replace a component into the container at a given position. |
void |
setBackground(int red,
int green,
int blue)
Set the background color. |
void |
setComponents(java.lang.Object[] list)
Reset the container with given components. |
void |
setFocusIndex(int index)
Set the index of the component that have the focus. If the component doesn't manage the focus, the next one is searched. If no component at all manages the focus, the focus index is set to -1 (no focus). |
void |
setFocusIndex(int index,
boolean ascending)
Set the index of the component that have the focus. If the component doesn't manage the focus, the next/prev one is searched (next if ascending, prev if not). If no component at all manages the focus, the focus index is set to -1 (no focus). |
Methods inherited from class javax.microedition.lcdui.Canvas |
getGameAction, getHeight, getKeyCode, getKeyName, getWidth, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints |
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 |
Constructor Detail |
public AbstractPanel()
Method Detail |
public void addContainerListener(ContainerListener listener)
listener
- The listener to add.public void append(Component component)
component
- The component to add.public boolean contains(Component component)
component
- A component.
public java.lang.Object getComponent(int index)
index
- The index of wanted component.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public java.lang.Object[] getComponents()
public int getCount()
public int getFocusIndex()
public int indexOf(Component component)
component
- A component.
public int indexOf(Component component, int index)
component
- A component.index
- the index to start searching from.
public void insert(Component component, int index)
component
- The component to insert.index
- Where to insert the new component.public boolean isEmpty()
public int lastIndexOf(Component component)
component
- A component.
public int lastIndexOf(Component component, int index)
component
- A component.index
- the index to start searching from.
public void remove(int index)
index
- The index of the component (First = 0).
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public void removeAll()
public void removeContainerListener(ContainerListener listener)
listener
- The listener to remove.public Component replace(Component component, int index)
component
- The new component to set.index
- The index of the component (First = 0).
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public void setBackground(int red, int green, int blue)
red
- The red component of the color.green
- The green component of the color.blue
- The blue component of the color.public void setComponents(java.lang.Object[] list)
list
- Component list to set in container, in paint order (old ones are lost).
If null or empty, the effect is equivalent than removeAll().public void setFocusIndex(int index)
index
- The index of component that newly have the focus, or a negative value to remove the focus.
java.lang.ArrayIndexOutOfBoundsException
- if given index is too high.public void setFocusIndex(int index, boolean ascending)
index
- The index of component that newly have the focus, or a negative value to remove the focus.ascending
- Must be true to search next component if targeted one don't manage the focus,
otherwise the previous one is searched.
java.lang.ArrayIndexOutOfBoundsException
- if given index is too high.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |