com.droplets.api
Class LabelButton

java.lang.Object
  |
  +--com.droplets.api.Component
        |
        +--com.droplets.api.Label
              |
              +--com.droplets.api.LabelButton
All Implemented Interfaces:
Clickable
Direct Known Subclasses:
ToolbarLabelButton

public class LabelButton
extends Label
implements Clickable

A component that is meant to be clicked like a button to trigger events, but displays like a label. It supports the following features:

The label displayed on the button can be queried and changed using getValue and setValue.


Fields inherited from class com.droplets.api.Label
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT
 
Fields inherited from class com.droplets.api.Component
ANCHOR_CENTER, ANCHOR_EAST, ANCHOR_NORTH, ANCHOR_NORTHEAST, ANCHOR_NORTHWEST, ANCHOR_SOUTH, ANCHOR_SOUTHEAST, ANCHOR_SOUTHWEST, ANCHOR_WEST, FILL_BOTH, FILL_HORIZONTAL, FILL_NONE, FILL_VERTICAL
 
Constructor Summary
LabelButton(LayoutPlacement p, Window window)
          Constructs a new LabelButton.
 
Method Summary
protected  void action(java.lang.String action, java.lang.String args)
          Called by the server when the user has performed an action on this component.
 void addClickListener(ClickListener l)
          Adds a click listener to the list.
 java.lang.String getActionCommand()
          Gets the action command for this button.
 Borders getDownBorders()
          Gets the borders that are displayed when the button is "down" - in other words, when the mouse button is depressed over the button.
 int getHorizontalTextDisplacement()
          Gets the horizontalTextDisplacement property, which determines how far to the right the text will move while the user is clicking on the button.
 java.lang.String getImageSetName()
          Gets the name of the image set to use for the button.
 java.lang.String getLabel()
          Gets the label of the button.
 Borders getOverBorders()
          Gets the borders that are displayed when the button is "over" - in other words, when the mouse is on the button but the mouse button is not depressed.
 Borders getUpBorders()
          Gets the borders that are displayed when the button is "up" - in other words, when the mouse button is not depressed over the button.
 int getVerticalTextDisplacement()
          Gets the verticalTextDisplacement property, which determines how far down the text will move while the user is clicking on the button.
protected  boolean isFocusTraversableDefault()
          See Component.isFocusTraversableDefault().
 void removeClickListener(ClickListener l)
          Removes a click listener from the list.
 void setActionCommand(java.lang.String actionCommand)
          Sets the action command for this button.
 void setDownBorders(Borders value)
          Sets the borders that are displayed when the button is "down" - in other words, when the mouse button is depressed over the button.
 void setDownBorders(Borders value, java.lang.String skin)
          Sets the borders that are displayed when the button is "down" - in other words, when the mouse button is depressed over the button.
 void setHorizontalTextDisplacement(int value)
          Sets the horizontalTextDisplacement property, which determines how far to the right the text will move while the user is clicking on the button.
 void setHorizontalTextDisplacement(int value, java.lang.String skin)
          Sets the horizontalTextDisplacement property, which determines how far to the right the text will move while the user is clicking on the button.
 void setImageSetName(java.lang.String value)
          Sets the name of the image set to use for the button.
 void setImageSetName(java.lang.String value, java.lang.String skin)
          Sets the name of the image set to use for the button.
 void setLabel(java.lang.String newLabel)
          Sets the value of the label.
 void setOverBorders(Borders value)
          Sets the borders that are displayed when the button is "over" - in other words, when the mouse is on the button but the mouse button is not depressed.
 void setOverBorders(Borders value, java.lang.String skin)
          Sets the borders that are displayed when the button is "over" - in other words, when the mouse is on the button but the mouse button is not depressed.
 void setTextDisplacement(int horizontal, int vertical)
          Convenience method for setting the horizontalTextDisplacement and the verticalTextDisplacement at the same time.
 void setTextDisplacement(int horizontal, int vertical, java.lang.String skin)
          Convenience method for setting the horizontalTextDisplacement and the verticalTextDisplacement at the same time.
 void setUpBorders(Borders value)
          Sets the borders that are displayed when the button is "up" - in other words, when the mouse button is not depressed over the button.
 void setUpBorders(Borders value, java.lang.String skin)
          Sets the borders that are displayed when the button is "up" - in other words, when the mouse button is not depressed over the button.
 void setVerticalTextDisplacement(int value)
          Sets the verticalTextDisplacement property, which determines how far down the text will move while the user is clicking on the button.
 void setVerticalTextDisplacement(int value, java.lang.String skin)
          Sets the verticalTextDisplacement property, which determines how far down the text will move while the user is clicking on the button.
 
Methods inherited from class com.droplets.api.Label
addAcceptDrop, addDropListener, getAlignment, getDragOverBgColor, getDragOverFgColor, getIsMoveHandle, getMargin, getShadow, getWidth, removeAcceptDrop, removeDropListener, setAlignment, setAlignment, setDragOverBgColor, setDragOverBgColor, setDragOverFgColor, setDragOverFgColor, setIsMoveHandle, setIsMoveHandle, setMargin, setMargin, setShadow, setShadow, setWidth, setWidth
 
Methods inherited from class com.droplets.api.Component
addActionListener, addAttributeChangeListener, addValueChangeListener, attributeChanged, constructionFailed, equals, fireActionEvent, fireAttributeChangeEvent, fireValueChangeEvent, getAnchor, getAttribute, getBgColor, getBoolAttribute, getBordersAttribute, getColorAttribute, getCursor, getCursorType, getDoubleAttribute, getEnabled, getFgColor, getFill, getFont, getGridHeight, getGridWidth, getGridX, getGridY, getInsets, getIntAttribute, getIPadX, getIPadY, getOpaque, getParent, getScriptingName, getSpecification, getStringAttribute, getToolTip, getValue, getVisible, getWeightX, getWeightY, getWindow, invalidate, isAddedToWindow, isContainer, isFocusTraversable, isValid, removeActionListener, removeAttributeChangeListener, removeValueChangeListener, requestFocus, reset, sendCommandAttribute, setAnchor, setAnchor, setArg, setAttribute, setBgColor, setBgColor, setBoolAttribute, setBordersAttribute, setColorAttribute, setCursor, setCursor, setCursorType, setDoubleAttribute, setEnabled, setEnabled, setEnterButton, setEnterButton, setEnterButton, setFgColor, setFgColor, setFill, setFill, setFocusTraversable, setFont, setFont, setGridHeight, setGridHeight, setGridWidth, setGridWidth, setGridX, setGridX, setGridY, setGridY, setInsets, setInsets, setIntAttribute, setIPadX, setIPadX, setIPadY, setIPadY, setItemListAttribute, setOpaque, setOpaque, setScriptingName, setStringAttribute, setToolTip, setValue, setValue, setVisible, setVisible, setWeightX, setWeightX, setWeightY, setWeightY, storeAttribute, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelButton

public LabelButton(LayoutPlacement p,
                   Window window)
Constructs a new LabelButton. Call setValue to set its text, but only after the enclosing window's specification has been created.
Parameters:
p - specifies how this component should be laid out in the enclosing panel (see LayoutPlacement)
window - the window in which this component will be placed
Method Detail

getHorizontalTextDisplacement

public int getHorizontalTextDisplacement()
Gets the horizontalTextDisplacement property, which determines how far to the right the text will move while the user is clicking on the button.
Returns:
the value

setHorizontalTextDisplacement

public void setHorizontalTextDisplacement(int value,
                                          java.lang.String skin)
Sets the horizontalTextDisplacement property, which determines how far to the right the text will move while the user is clicking on the button.
Parameters:
value - the value
skin - the skin name to use for this attribute

setHorizontalTextDisplacement

public void setHorizontalTextDisplacement(int value)
Sets the horizontalTextDisplacement property, which determines how far to the right the text will move while the user is clicking on the button.
Parameters:
value - the value

getVerticalTextDisplacement

public int getVerticalTextDisplacement()
Gets the verticalTextDisplacement property, which determines how far down the text will move while the user is clicking on the button.
Returns:
the value

setVerticalTextDisplacement

public void setVerticalTextDisplacement(int value,
                                        java.lang.String skin)
Sets the verticalTextDisplacement property, which determines how far down the text will move while the user is clicking on the button.
Parameters:
the - value
skin - the skin name to use for this attribute

setVerticalTextDisplacement

public void setVerticalTextDisplacement(int value)
Sets the verticalTextDisplacement property, which determines how far down the text will move while the user is clicking on the button.
Parameters:
the - value

setTextDisplacement

public void setTextDisplacement(int horizontal,
                                int vertical,
                                java.lang.String skin)
Convenience method for setting the horizontalTextDisplacement and the verticalTextDisplacement at the same time.
Parameters:
horizontal - number of pixels to the right to move the text while the mouse button is depressed over the component
horizontal - number of pixels down to move the text while the mouse button is depressed over the component
skin - the skin name to use for this attribute

setTextDisplacement

public void setTextDisplacement(int horizontal,
                                int vertical)
Convenience method for setting the horizontalTextDisplacement and the verticalTextDisplacement at the same time.
Parameters:
horizontal - number of pixels to the right to move the text while the mouse button is depressed over the component
horizontal - number of pixels down to move the text while the mouse button is depressed over the component

getUpBorders

public Borders getUpBorders()
Gets the borders that are displayed when the button is "up" - in other words, when the mouse button is not depressed over the button.
Returns:
the "up" borders, or null if none

setUpBorders

public void setUpBorders(Borders value,
                         java.lang.String skin)
Sets the borders that are displayed when the button is "up" - in other words, when the mouse button is not depressed over the button. Up, Down, and Over borders should have the same widths as each other Use the background color if there are sides you want to leave off of some
Parameters:
value - the desired "up" borders
skin - skin name to use for this attribute

setUpBorders

public void setUpBorders(Borders value)
Sets the borders that are displayed when the button is "up" - in other words, when the mouse button is not depressed over the button. Up, Down, and Over borders should have the same widths as each other Use the background color if there are sides you want to leave off of some
Parameters:
value - the desired "up" borders

getOverBorders

public Borders getOverBorders()
Gets the borders that are displayed when the button is "over" - in other words, when the mouse is on the button but the mouse button is not depressed.
Returns:
the "over" borders, or null if none

setOverBorders

public void setOverBorders(Borders value,
                           java.lang.String skin)
Sets the borders that are displayed when the button is "over" - in other words, when the mouse is on the button but the mouse button is not depressed. Up, Down, and Over borders should have the same widths as each other Use the background color if there are sides you want to leave off of some
Parameters:
value - the desired "over" borders
skin - skin name to use for this attribute

setOverBorders

public void setOverBorders(Borders value)
Sets the borders that are displayed when the button is "over" - in other words, when the mouse is on the button but the mouse button is not depressed. Up, Down, and Over borders should have the same widths as each other Use the background color if there are sides you want to leave off of some
Parameters:
value - the desired "over" borders

getDownBorders

public Borders getDownBorders()
Gets the borders that are displayed when the button is "down" - in other words, when the mouse button is depressed over the button.
Returns:
the "down" borders, or null if none

setDownBorders

public void setDownBorders(Borders value,
                           java.lang.String skin)
Sets the borders that are displayed when the button is "down" - in other words, when the mouse button is depressed over the button. Up, Down, and Over borders should have the same widths as each other Use the background color if there are sides you want to leave off of some
Parameters:
value - the desired "down" borders
skin - skin name to use for this attribute

setDownBorders

public void setDownBorders(Borders value)
Sets the borders that are displayed when the button is "down" - in other words, when the mouse button is depressed over the button. Up, Down, and Over borders should have the same widths as each other Use the background color if there are sides you want to leave off of some
Parameters:
value - the desired "down" borders

getImageSetName

public java.lang.String getImageSetName()
Gets the name of the image set to use for the button. See ImageButton for details.
Returns:
the image set name

setImageSetName

public void setImageSetName(java.lang.String value,
                            java.lang.String skin)
Sets the name of the image set to use for the button. See ImageButton for details.
Parameters:
value - the image set name
skin - the skin name to use for this attribute

setImageSetName

public void setImageSetName(java.lang.String value)
Sets the name of the image set to use for the button. See ImageButton for details.
Parameters:
value - the image set name

action

protected void action(java.lang.String action,
                      java.lang.String args)
Description copied from class: Component
Called by the server when the user has performed an action on this component. Subclasses should overridde to handle any actions that they need to handle in a special way - for example, if they maintain a separate listener list for some kinds of actions. If a subclass gets an action it doesn't recognize or is not interested in, it should pass the call on to this implementation in order to support notification of ActionListeners.
Overrides:
action in class Label
Following copied from class: com.droplets.api.Component
Parameters:
action - Identifies the type of action that occurred
args - Action-specific arguments (extra information)

addClickListener

public void addClickListener(ClickListener l)
Description copied from interface: Clickable
Adds a click listener to the list.
Specified by:
addClickListener in interface Clickable
Following copied from interface: com.droplets.api.Clickable
Parameters:
l - the listener to add

removeClickListener

public void removeClickListener(ClickListener l)
Description copied from interface: Clickable
Removes a click listener from the list.
Specified by:
removeClickListener in interface Clickable
Following copied from interface: com.droplets.api.Clickable
Parameters:
l - the listener to remove

setActionCommand

public void setActionCommand(java.lang.String actionCommand)
Sets the action command for this button. The action command is sent in the ActionEvent that this button fires when it has been clicked.
Parameters:
actionCommand - the new action command

getActionCommand

public java.lang.String getActionCommand()
Gets the action command for this button. If the action command has not been set, this method will return the buttons label.
Returns:
the action command

setLabel

public void setLabel(java.lang.String newLabel)
Sets the value of the label.

getLabel

public java.lang.String getLabel()
Gets the label of the button.

isFocusTraversableDefault

protected boolean isFocusTraversableDefault()
See Component.isFocusTraversableDefault().
Overrides:
isFocusTraversableDefault in class Label
Following copied from class: com.droplets.api.Component
See Also:
Component.setFocusTraversable(boolean)


Copyright © Droplets, 2001. All Rights Reserved.