nextapp.echo
Class CButton

java.lang.Object
  extended by nextapp.echo.AbstractComponent
      extended by nextapp.echo.AbstractButton
          extended by nextapp.echo.Button
              extended by nextapp.echo.CButton
All Implemented Interfaces:
java.io.Serializable, Component, ToolTipSupport

public class CButton
extends Button

A highly configurable push button.

See Also:
Serialized Form

Field Summary
static java.lang.String BORDER_COLOR_CHANGED_PROPERTY
           
static int BORDER_INSET
          A border style that causes a simulated 3D border to be rendered, such that the button appears recessed.
static int BORDER_NONE
          A border style that causes no border to be rendered.
static int BORDER_OUTSET
          A border style that causes a simulated 3D border to be rendered, such that the button appears raised.
static java.lang.String BORDER_SIZE_CHANGED_PROPERTY
           
static int BORDER_SOLID
          A border style that causes a solid, monochrome border to be rendered in in the specified color.
static java.lang.String BORDER_STYLE_CHANGED_PROPERTY
           
static Insets DEFAULT_INSETS
           
static java.lang.String HEIGHT_EXTENT_CHANGED_PROPERTY
           
static java.lang.String INSETS_CHANGED_PROPERTY
           
static java.lang.String PRESSED_BACKGROUND_CHANGED_PROPERTY
           
static java.lang.String PRESSED_BORDER_COLOR_CHANGED_PROPERTY
           
static java.lang.String PRESSED_BORDER_STYLE_CHANGED_PROPERTY
           
static java.lang.String PRESSED_FOREGROUND_CHANGED_PROPERTY
           
static java.lang.String ROLLOVER_BORDER_COLOR_CHANGED_PROPERTY
           
static java.lang.String STYLE_BORDER_COLOR
          A style constant for the Border Color property.
static java.lang.String STYLE_BORDER_SIZE
          A style constant for the Border Size property.
static java.lang.String STYLE_BORDER_STYLE
          A style constant for the Border Style property.
static java.lang.String STYLE_HEIGHT_EXTENT
          A style constant for the Height Extent property.
static java.lang.String STYLE_INSETS
          A style constant for the Insets property.
static java.lang.String STYLE_PRESSED_BACKGROUND
          A style constant for the Pressed Background property.
static java.lang.String STYLE_PRESSED_BORDER_COLOR
          A style constant for the Pressed Border Color property.
static java.lang.String STYLE_PRESSED_BORDER_STYLE
          A style constant for the Pressed Border Style property.
static java.lang.String STYLE_PRESSED_FOREGROUND
          A style constant for the Pressed Foreground property.
static java.lang.String STYLE_ROLLOVER_BORDER_COLOR
          A style constant for the Rollover Border Color property.
static java.lang.String STYLE_WIDTH_EXTENT
          A style constant for the Width Extent property.
static java.lang.String WIDTH_EXTENT_CHANGED_PROPERTY
           
 
Fields inherited from class nextapp.echo.AbstractButton
ACTION_COMMAND_CHANGED_PROPERTY, CSS_CLASS_CHANGED_PROPERTY, DISABLED_CSS_CLASS_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, ICON_TEXT_MARGIN_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, NOTABSTOP_CHANGED_PROPERTY, ROLLOVER_BACKGROUND_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_FONT_CHANGED_PROPERTY, ROLLOVER_FOREGROUND_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, STYLE_HORIZONTAL_ALIGNMENT, STYLE_HORIZONTAL_TEXT_POSITION, STYLE_ICON_TEXT_MARGIN, STYLE_ROLLOVER_BACKGROUND, STYLE_ROLLOVER_ENABLED, STYLE_ROLLOVER_FONT, STYLE_ROLLOVER_FOREGROUND, STYLE_VERTICAL_ALIGNMENT, STYLE_VERTICAL_TEXT_POSITION, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.ToolTipSupport
TOOL_TIP_TEXT_CHANGED_PROPERTY
 
Fields inherited from interface nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, SELECTABLE_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
CButton()
          Creates a button with no text or icon.
CButton(ImageReference icon)
          Creates a button with an icon.
CButton(java.lang.String text)
          Creates a button with text.
CButton(java.lang.String text, ImageReference icon)
          Creates a button with text and an icon.
 
Method Summary
 void applyStyle(Style style)
          Sets stylistic properties of this component based on a Style object.
 Color getBorderColor()
          Returns the border color of the button.
 int getBorderSize()
          Returns the size of the border.
 int getBorderStyle()
          Returns the (non-pressed) border style.
 Extent getHeightExtent()
          Returns the (minimum) height of the button.
 Insets getInsets()
          Returns the Insets of the button.
 Color getPressedBackground()
          Returns the pressed background color of the button.
 Color getPressedBorderColor()
          Returns the pressed border color of the button.
 int getPressedBorderStyle()
          Returns the pressed border style of the button.
 Color getPressedForeground()
          Returns The pressed foreground of the button.
 Color getRolloverBorderColor()
          Returns The rollover border color of the button.
 Extent getWidthExtent()
          Returns the (minimum) width of the button.
 void setBorderColor(Color newValue)
          Sets the border color of the button.
 void setBorderSize(int newValue)
          Sets the size of the border surrounding the button.
 void setBorderStyle(int newValue)
          Sets the border style of the button.
 void setHeightExtent(Extent newValue)
          Sets the (minimum) height of the button.
 void setInsets(Insets newValue)
          Sets the insets of the button (distance between border edge and content of button).
 void setPressedBackground(Color newValue)
          Sets the pressed background color.
 void setPressedBorderColor(Color newValue)
          Set the pressed border color.
 void setPressedBorderStyle(int newValue)
          Sets the pressed border style.
 void setPressedForeground(Color newValue)
          Sets the pressed foreground color.
 void setRolloverBorderColor(Color newValue)
          Sets the rollover border color.
 void setWidthExtent(Extent newValue)
          Sets the (minimum) width of the button.
 
Methods inherited from class nextapp.echo.AbstractButton
addActionListener, addChangeListener, addItemListener, doAction, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getCssClass, getCssClassDisabled, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextMargin, getModel, getRolloverBackground, getRolloverFont, getRolloverForeground, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getText, getToolTipText, getVerticalAlignment, getVerticalTextPosition, hasActionListeners, isAsync, isNoTabStop, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setAsync, setCssClass, setCssClassDisabled, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextMargin, setModel, setNoTabStop, setRolloverBackground, setRolloverEnabled, setRolloverFont, setRolloverForeground, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setToolTipText, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class nextapp.echo.AbstractComponent
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getClientId, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getListenerList, getLocale, getParent, indexOf, init, isAncestorOf, isDifferent, isEnabled, isFocused, isRecursivelyVisible, isRegistered, isSelectableForScriptRecorder, isShowing, isVisible, processHierarchyEvent, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setClientId, setEnabled, setFocused, setFont, setForeground, setIdentifier, setLocale, setParent, setRegistered, setSelectableForScriptRecorder, setVisible, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BORDER_INSET

public static final int BORDER_INSET
A border style that causes a simulated 3D border to be rendered, such that the button appears recessed.

See Also:
Constant Field Values

BORDER_NONE

public static final int BORDER_NONE
A border style that causes no border to be rendered.

See Also:
Constant Field Values

BORDER_OUTSET

public static final int BORDER_OUTSET
A border style that causes a simulated 3D border to be rendered, such that the button appears raised.

See Also:
Constant Field Values

BORDER_SOLID

public static final int BORDER_SOLID
A border style that causes a solid, monochrome border to be rendered in in the specified color.

See Also:
Constant Field Values

STYLE_BORDER_COLOR

public static final java.lang.String STYLE_BORDER_COLOR
A style constant for the Border Color property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

STYLE_BORDER_SIZE

public static final java.lang.String STYLE_BORDER_SIZE
A style constant for the Border Size property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_BORDER_STYLE

public static final java.lang.String STYLE_BORDER_STYLE
A style constant for the Border Style property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_HEIGHT_EXTENT

public static final java.lang.String STYLE_HEIGHT_EXTENT
A style constant for the Height Extent property. Values of this key must be of type nextapp.echo.Extent.

See Also:
Constant Field Values

STYLE_INSETS

public static final java.lang.String STYLE_INSETS
A style constant for the Insets property. Values of this key must be of type nextapp.echo.Insets.

See Also:
Constant Field Values

STYLE_PRESSED_BORDER_COLOR

public static final java.lang.String STYLE_PRESSED_BORDER_COLOR
A style constant for the Pressed Border Color property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

STYLE_PRESSED_BORDER_STYLE

public static final java.lang.String STYLE_PRESSED_BORDER_STYLE
A style constant for the Pressed Border Style property. Values of this key must be of type java.lang.Integer.

See Also:
Constant Field Values

STYLE_PRESSED_FOREGROUND

public static final java.lang.String STYLE_PRESSED_FOREGROUND
A style constant for the Pressed Foreground property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

STYLE_PRESSED_BACKGROUND

public static final java.lang.String STYLE_PRESSED_BACKGROUND
A style constant for the Pressed Background property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

STYLE_ROLLOVER_BORDER_COLOR

public static final java.lang.String STYLE_ROLLOVER_BORDER_COLOR
A style constant for the Rollover Border Color property. Values of this key must be of type nextapp.echo.Color.

See Also:
Constant Field Values

STYLE_WIDTH_EXTENT

public static final java.lang.String STYLE_WIDTH_EXTENT
A style constant for the Width Extent property. Values of this key must be of type nextapp.echo.Extent.

See Also:
Constant Field Values

BORDER_COLOR_CHANGED_PROPERTY

public static final java.lang.String BORDER_COLOR_CHANGED_PROPERTY
See Also:
Constant Field Values

BORDER_SIZE_CHANGED_PROPERTY

public static final java.lang.String BORDER_SIZE_CHANGED_PROPERTY
See Also:
Constant Field Values

BORDER_STYLE_CHANGED_PROPERTY

public static final java.lang.String BORDER_STYLE_CHANGED_PROPERTY
See Also:
Constant Field Values

HEIGHT_EXTENT_CHANGED_PROPERTY

public static final java.lang.String HEIGHT_EXTENT_CHANGED_PROPERTY
See Also:
Constant Field Values

INSETS_CHANGED_PROPERTY

public static final java.lang.String INSETS_CHANGED_PROPERTY
See Also:
Constant Field Values

PRESSED_BORDER_COLOR_CHANGED_PROPERTY

public static final java.lang.String PRESSED_BORDER_COLOR_CHANGED_PROPERTY
See Also:
Constant Field Values

PRESSED_BORDER_STYLE_CHANGED_PROPERTY

public static final java.lang.String PRESSED_BORDER_STYLE_CHANGED_PROPERTY
See Also:
Constant Field Values

PRESSED_BACKGROUND_CHANGED_PROPERTY

public static final java.lang.String PRESSED_BACKGROUND_CHANGED_PROPERTY
See Also:
Constant Field Values

PRESSED_FOREGROUND_CHANGED_PROPERTY

public static final java.lang.String PRESSED_FOREGROUND_CHANGED_PROPERTY
See Also:
Constant Field Values

ROLLOVER_BORDER_COLOR_CHANGED_PROPERTY

public static final java.lang.String ROLLOVER_BORDER_COLOR_CHANGED_PROPERTY
See Also:
Constant Field Values

WIDTH_EXTENT_CHANGED_PROPERTY

public static final java.lang.String WIDTH_EXTENT_CHANGED_PROPERTY
See Also:
Constant Field Values

DEFAULT_INSETS

public static final Insets DEFAULT_INSETS
Constructor Detail

CButton

public CButton()
Creates a button with no text or icon.


CButton

public CButton(ImageReference icon)
Creates a button with an icon.

Parameters:
icon - The icon to be displayed in the button.

CButton

public CButton(java.lang.String text)
Creates a button with text.

Parameters:
text - The text to be displayed in the button.

CButton

public CButton(java.lang.String text,
               ImageReference icon)
Creates a button with text and an icon.

Parameters:
text - The text to be displayed in the button.
icon - The icon to be displayed in the button.
Method Detail

applyStyle

public void applyStyle(Style style)
Description copied from interface: Component
Sets stylistic properties of this component based on a Style object. The version of this method in Component will set foreground and background colors and the font from the style if they are present. Components should override this method if they allow more properties to be set from a style object, and should call super.applyStyle() if necessary.

Specified by:
applyStyle in interface Component
Overrides:
applyStyle in class AbstractButton
Parameters:
style - The style object from which to retrieve properties for this Component.
See Also:
Component.applyStyle(nextapp.echo.Style)

getBorderColor

public Color getBorderColor()
Returns the border color of the button.

Returns:
The border color of the button.

getBorderSize

public int getBorderSize()
Returns the size of the border.

Returns:
The size of the border.

getBorderStyle

public int getBorderStyle()
Returns the (non-pressed) border style.

Returns:
The border style.

getHeightExtent

public Extent getHeightExtent()
Returns the (minimum) height of the button.

Returns:
The height of the button.

getInsets

public Insets getInsets()
Returns the Insets of the button.

Returns:
The Insets of the button.

getPressedBackground

public Color getPressedBackground()
Returns the pressed background color of the button.

Returns:
The pressed background color of the button.

getPressedBorderColor

public Color getPressedBorderColor()
Returns the pressed border color of the button.

Returns:
The pressed border color of the button.

getPressedBorderStyle

public int getPressedBorderStyle()
Returns the pressed border style of the button.

Returns:
The pressed border style of the button.

getPressedForeground

public Color getPressedForeground()
Returns The pressed foreground of the button.

Returns:
The pressed foreground of the button.

getRolloverBorderColor

public Color getRolloverBorderColor()
Returns The rollover border color of the button.

Returns:
The rollover border color of the button.

getWidthExtent

public Extent getWidthExtent()
Returns the (minimum) width of the button.

Returns:
The width of the button.

setBorderColor

public void setBorderColor(Color newValue)
Sets the border color of the button.

Parameters:
newValue - The new border color of the button.

setBorderSize

public void setBorderSize(int newValue)
Sets the size of the border surrounding the button.

Parameters:
newValue - the new border size, in pixels.

setBorderStyle

public void setBorderStyle(int newValue)
Sets the border style of the button.

Parameters:
newValue - The new border style, one of the following values:
  • BORDER_NONE
  • BORDER_SOLID
  • BORDER_INSET
  • BORDER_OUTSET

setHeightExtent

public void setHeightExtent(Extent newValue)
Sets the (minimum) height of the button.

Parameters:
newValue - The new height of the button.

setInsets

public void setInsets(Insets newValue)
Sets the insets of the button (distance between border edge and content of button).

Parameters:
newValue - The new Insets value.

setPressedBackground

public void setPressedBackground(Color newValue)
Sets the pressed background color.

Parameters:
newValue - The new pressed background color.

setPressedBorderColor

public void setPressedBorderColor(Color newValue)
Set the pressed border color.

Parameters:
newValue - The new pressed border color.

setPressedBorderStyle

public void setPressedBorderStyle(int newValue)
Sets the pressed border style.

Parameters:
newValue - The new pressed border style, one of the following values:
  • BORDER_NONE
  • BORDER_SOLID
  • BORDER_INSET
  • BORDER_OUTSET

setPressedForeground

public void setPressedForeground(Color newValue)
Sets the pressed foreground color.

Parameters:
newValue - The new pressed foreground color.

setRolloverBorderColor

public void setRolloverBorderColor(Color newValue)
Sets the rollover border color.

Parameters:
newValue - The new rollover border color.

setWidthExtent

public void setWidthExtent(Extent newValue)
Sets the (minimum) width of the button.

Parameters:
newValue - The new width of the button.