|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfds.micro.ui.Component
This class defines a root object for UI components present in package fds.micro.ui.
Warning: DO NOT USE this package for standard interfaces, or if your want a standard rendering and behaviour.
All components defined here have been written to provide rendering control to the programmer.
Use them when a sexy interface is vital and you don't mind of complex features.
In all other cases, use sub-classes of javax.microedition.lcdui.Item.
Basically, a component have a graphic implementation, is located at a specific position, and have width and height determined at rendering time. We can also specify a maximum width and height to make sure the component doesn't take too much space. Finally, a component can have the focus and must graphicaly render this kind of behaviour.
A component is dedicated to be used in a sub-class of fds.micro.ui.AbstractPanel.
If you want to write your own component you must respect following rules:
AbstractPanel
Field Summary | |
static int |
INTERN_BOTTOM_VALIGN
Vertically aligns parts within a component on the bottom of component border. |
static int |
INTERN_CENTER_HALIGN
Horizontally centers parts within a component. |
static int |
INTERN_CENTER_VALIGN
Vertically centers parts within a component. |
static int |
INTERN_LEFT_HALIGN
Horizontally aligns parts within a component on the left of component border. |
static int |
INTERN_RIGHT_HALIGN
Horizontally aligns parts within a component on the right of component border. |
static int |
INTERN_TOP_VALIGN
Vertically aligns parts within a component on the top of component border. |
Constructor Summary | |
Component()
|
Method Summary | |
void |
addFocusListener(FocusListener listener)
Add a listener object that will receive focus events produced by this component. |
void |
addItemListener(ComponentListener listener)
Add a listener object that will receive component events produced by this component. |
boolean |
equals(java.lang.Object obj)
|
int |
getHAlign()
Get the current horizontal alignment between this component parts. |
int |
getHeight()
|
AbstractPanel |
getParent()
Get the parent container. |
int |
getVAlign()
Get the current vertical alignment between this component parts. |
int |
getWidth()
|
int |
getX()
|
int |
getY()
|
boolean |
isDisabled()
Get the flag that indicates if component is disabled. |
boolean |
isHaveFocus()
|
boolean |
isHidden()
Get the visible state of the component. |
boolean |
isManageFocus()
|
boolean |
isOpaque()
Get the opaque flag. |
abstract void |
keyPressed(int keyCode,
int gameAction)
Called to notify the component that a key is pressed. |
abstract void |
pointerPressed(int xpos,
int ypos)
Called to notify the component that pointer device was pressed. |
void |
removeFocusListener(FocusListener listener)
Remove a focus listener. |
void |
removeItemListener(ComponentListener listener)
Remove an component listener. |
void |
setBackground(int red,
int green,
int blue)
Set the component background color (under the component itself). |
void |
setDisabled(boolean disabled)
Disable/enable the component. |
void |
setFocusColor(int red,
int green,
int blue)
Set the color used to render the focus. |
void |
setHAlign(int hAlign)
Change the horizontal alignment between this component parts. |
void |
setHidden(boolean hidden)
Hide or show the component. |
void |
setLocation(int x,
int y)
|
void |
setManageFocus(boolean manageFocus)
Specify if want want the component to manage focus. WARNING: Do not use this feature if your application can run on a platform without pointing device. |
void |
setMaximumSize(int width,
int height)
Set the maximum size for this component. |
void |
setOpaque(boolean opaque)
Set a new value for opaque flag. |
void |
setVAlign(int vAlign)
Change the vertical alignment between this component parts. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INTERN_BOTTOM_VALIGN
public static final int INTERN_CENTER_HALIGN
public static final int INTERN_CENTER_VALIGN
public static final int INTERN_LEFT_HALIGN
public static final int INTERN_RIGHT_HALIGN
public static final int INTERN_TOP_VALIGN
Constructor Detail |
public Component()
Method Detail |
public void addFocusListener(FocusListener listener)
listener
- The listener to add.public void addItemListener(ComponentListener listener)
listener
- The listener to add.public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)
public int getHAlign()
public int getHeight()
public AbstractPanel getParent()
public int getVAlign()
public int getWidth()
public int getX()
public int getY()
public boolean isDisabled()
public boolean isHaveFocus()
public boolean isHidden()
public boolean isManageFocus()
public boolean isOpaque()
public abstract void keyPressed(int keyCode, int gameAction)
keyCode
- The key code.gameAction
- Game action corresponding to the key code.public abstract void pointerPressed(int xpos, int ypos)
xpos
- The X position of pointer on parent Canvas.ypos
- The Y position of pointer on parent Canvas.public void removeFocusListener(FocusListener listener)
listener
- The listener to remove.public void removeItemListener(ComponentListener listener)
listener
- The listener to remove.public void setBackground(int red, int green, int blue)
red
- The red component of the color to set.green
- The green component of the color to set.blue
- The blue component of the color to set.public void setDisabled(boolean disabled)
disabled
- Must be true to disabled the component, and false enabled to enable it.public void setFocusColor(int red, int green, int blue)
red
- The red component of the color to set.green
- The green component of the color to set.blue
- The blue component of the color to set.public void setHAlign(int hAlign)
hAlign
- The component horizontal alignment policy for internal parts.
Can take values INTERN_LEFT_HALIGN, INTERN_CENTER_HALIGN (default) or INTERN_RIGHT_HALIGN.public void setHidden(boolean hidden)
hidden
- Must be true to hide the component, and false to show it.public void setLocation(int x, int y)
x
- The x position.y
- The y position.public void setManageFocus(boolean manageFocus)
manageFocus
- Must be true to indicates that this component manages the focus.public void setMaximumSize(int width, int height)
width
- The maximum width.height
- The maximum height.public void setOpaque(boolean opaque)
opaque
- Must be true for the component to paint a background.public void setVAlign(int vAlign)
vAlign
- The component vertical alignment policy for internal parts.
Can take values INTERN_TOP_VALIGN, INTERN_CENTER_VALIGN (default) or INTERN_BOTTOM_VALIGN.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |