|
Java DTV API 1.0 12-Dec-2008 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.lwuit.Component
com.sun.dtv.ui.MatteEnabledComponent
com.sun.dtv.ui.ViewOnlyComponent
com.sun.lwuit.Label
com.sun.lwuit.Button
Button is the base class for several UI widgets allowing clickability. It has 3 states: rollover, pressed and the default state it can also have ActionListeners that react when the Button is clicked.
| Field Summary | |
static int |
STATE_DEFAULT
Indicates the default state of a button which is neither pressed nor focused. |
static int |
STATE_PRESSED
Indicates the pressed state of a button. |
static int |
STATE_ROLLOVER
Indicates the rollover state of a button which is equivalent to focused for most uses. |
| Fields inherited from class com.sun.dtv.ui.ViewOnlyComponent |
HORIZONTAL_ALIGN_CENTER, HORIZONTAL_ALIGN_JUSTIFIED, HORIZONTAL_ALIGN_LEFT, HORIZONTAL_ALIGN_RIGHT, SCALE_ASPECT_PROOF, SCALE_NO, SCALE_NO_ASPECT_PROOF, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_JUSTIFIED, VERTICAL_ALIGN_TOP |
| Fields inherited from class com.sun.lwuit.Component |
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
| Fields inherited from interface com.sun.dtv.ui.Animated |
ALTERNATING, LOOP, REPEATING |
| Constructor Summary | |
Button()
Constructs a button with an empty string for its text. |
|
Button(Command cmd)
Allows binding a command to a button for ease of use. |
|
Button(Image icon)
Constructs a button with the specified image. |
|
Button(String text)
Constructs a button with the specified text. |
|
Button(String text,
Image icon)
Constructor a button with text and image. |
|
| Method Summary | |
void |
addActionListener(ActionListener l)
Adds a listener to the button which will cause an event to dispatch on click. |
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content. |
protected void |
fireClicked()
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly. |
protected Border |
getBorder()
Normally returns getStyle().getBorder() but some subclasses might use this to programmatically replace the border in runtime e.g. for a pressed border effect |
Image |
getPressedIcon()
Indicates the icon that is displayed on the button when the button is in pressed state. |
Image |
getRolloverIcon()
Indicates the icon that is displayed on the button when the button is in rolled over state. |
int |
getState()
Returns the button state. |
protected String |
getUIID()
Unique identifier for a component, must be overriden for a component so a style can be applied to the component. |
protected boolean |
isSelectableInteraction()
This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device. |
void |
keyPressed(int keyCode)
If this Component is focused, the key pressed event will call this method. |
void |
keyReleased(int keyCode)
If this Component is focused, the key released event will call this method. |
void |
paint(Graphics g)
Method to paint the component. |
void |
pointerPressed(int x,
int y)
If this Component is focused, the pointer pressed event will call this method. |
void |
pointerReleased(int x,
int y)
If this Component is focused, the pointer released event will call this method. |
void |
removeActionListener(ActionListener l)
Removes the given action listener from the button. |
void |
setPressedIcon(Image pressedIcon)
Indicates the icon that is displayed on the button when the button is in pressed state. |
void |
setRolloverIcon(Image rolloverIcon)
Indicates the icon that is displayed on the button when the button is in rolled over state. |
| Methods inherited from class com.sun.lwuit.Label |
animate, getAlignment, getBaselineResizeBehavior, getGap, getIcon, getShiftText, getText, getTextPosition, getVerticalAlignment, isEndsWith3Points, isTickerEnabled, isTickerRunning, paramString, setAlignment, setEndsWith3Points, setGap, setIcon, setShiftText, setText, setTextPosition, setTickerEnabled, setVerticalAlignment, startTicker, stopTicker |
| Methods inherited from class com.sun.dtv.ui.ViewOnlyComponent |
getAnimateContent, getGraphicContent, getHorizontalAlignment, getInteractionState, getScalingMode, getTextContent, getTextLayoutManager, isOpaque, setAnimateContent, setGraphicContent, setHorizontalAlignment, setInteractionState, setScalingMode, setTextContent, setTextLayoutManager |
| Methods inherited from class com.sun.dtv.ui.MatteEnabledComponent |
getMatte, isDoubleBuffered, processEvent, setMatte |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int STATE_ROLLOVER
public static final int STATE_PRESSED
public static final int STATE_DEFAULT
| Constructor Detail |
public Button()
public Button(String text)
text - label appearing on the buttonpublic Button(Command cmd)
cmd - command whose text would be used for the button and would
receive action events from the buttonpublic Button(Image icon)
icon - appearing on the button
public Button(String text,
Image icon)
text - label appearing on the buttonicon - image appearing on the button| Method Detail |
protected String getUIID()
Component
getUIID in class Labelpublic int getState()
public Image getPressedIcon()
setPressedIcon(com.sun.lwuit.Image),
STATE_PRESSEDpublic Image getRolloverIcon()
setRolloverIcon(com.sun.lwuit.Image),
STATE_ROLLOVERpublic void setRolloverIcon(Image rolloverIcon)
rolloverIcon - icon to usegetRolloverIcon(),
STATE_ROLLOVERpublic void setPressedIcon(Image pressedIcon)
pressedIcon - icon usedgetPressedIcon(),
STATE_PRESSEDpublic void addActionListener(ActionListener l)
l - implementation of the action listener interfaceremoveActionListener(com.sun.lwuit.events.ActionListener)public void removeActionListener(ActionListener l)
l - implementation of the action listener interfaceaddActionListener(com.sun.lwuit.events.ActionListener)public void keyPressed(int keyCode)
Component
keyPressed in class ComponentkeyCode - the key code value to indicate a physical key.public void keyReleased(int keyCode)
Component
keyReleased in class ComponentkeyCode - the key code value to indicate a physical key.protected void fireClicked()
Component
fireClicked in class Componentprotected boolean isSelectableInteraction()
Component
isSelectableInteraction in class Component
public void pointerPressed(int x,
int y)
Component
pointerPressed in class Componentx - the pointer x coordinatey - the pointer y coordinate
public void pointerReleased(int x,
int y)
Component
pointerReleased in class Componentx - the pointer x coordinatey - the pointer y coordinatepublic void paint(Graphics g)
ViewOnlyComponent
paint in interface Animatedpaint in class Labelprotected Dimension calcPreferredSize()
Component
calcPreferredSize in class Labelprotected Border getBorder()
Component
getBorder in class Component
|
Java DTV API 1.0 12-Dec-2008 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||