Class org.aswing.AbstractButton

Description

Field Index

BOTTOM, CENTER, HORIZONTAL, LEFT, ON_KILL_FOCUS, ON_SELECTION_CHANGED, ON_SET_FOCUS, ON_STATE_CHANGED, RIGHT, TOP, VERTICAL

Inherited from Component

Inherited from EventDispatcher

Method Index

addActionListener(), addSelectionListener(), getDisabledIcon(), getDisabledSelectedIcon(), getHorizontalAlignment(), getHorizontalTextPosition(), getIcon(), getIconTextGap(), getMargin(), getModel(), getPressedIcon(), getRollOverIcon(), getRollOverSelectedIcon(), getSelectedIcon(), getText(), getUI(), getVerticalAlignment(), getVerticalTextPosition(), isRollOverEnabled(), isSelected(), setContent(), setDisabledIcon(), setDisabledSelectedIcon(), setEnabled(), setHorizontalAlignment(), setHorizontalTextPosition(), setIcon(), setIconTextGap(), setMargin(), setModel(), setPressedIcon(), setRollOverEnabled(), setRollOverIcon(), setRollOverSelectedIcon(), setSelected(), setSelectedIcon(), setText(), setUI(), setVerticalAlignment(), setVerticalTextPosition(), updateUI()

Inherited from Component

Inherited from EventDispatcher

Field Detail

ON_SET_FOCUS

static public ON_SET_FOCUS:String

ON_KILL_FOCUS

static public ON_KILL_FOCUS:String

ON_STATE_CHANGED

static public ON_STATE_CHANGED:String
When the button's state changed.
onStateChanged Event{source:AbstractButton}

ON_SELECTION_CHANGED

static public ON_SELECTION_CHANGED:String
When the button's selection changed. fired when diselected or selected.
onSelectionChanged Event{source:AbstractButton}

CENTER

static public CENTER:Number
A fast access to ASWingConstants Constant

See Also

TOP

static public TOP:Number
A fast access to ASWingConstants Constant

See Also

LEFT

static public LEFT:Number
A fast access to ASWingConstants Constant

See Also

BOTTOM

static public BOTTOM:Number
A fast access to ASWingConstants Constant

See Also

RIGHT

static public RIGHT:Number
A fast access to ASWingConstants Constant

See Also

HORIZONTAL

static public HORIZONTAL:Number
A fast access to ASWingConstants Constant

See Also

VERTICAL

static public VERTICAL:Number
A fast access to ASWingConstants Constant

See Also

Method Detail

getModel

public function getModel():ButtonModel

Returns the model that this button represents.

Return

the model property

See Also

setModel

public function setModel(newModel:ButtonModel):Void

Sets the model that this button represents.

Parameters

See Also

getUI

public function getUI():ButtonUI

Returns the L&F object that renders this component.

Return

the ButtonUI object

See Also

setUI

public function setUI(ui:ButtonUI):Void

Sets the L&F object that renders this component.

Parameters

uithe ButtonUI L&F object

Overrides

setUI() in org.aswing.Component

See Also

updateUI

public function updateUI():Void

Resets the UI property to a value from the current look and feel. Subtypes of AbstractButton should override this to update the UI. For example, JButton might do the following:

      setUI(ButtonUI(UIManager.getUI(this)));
 

addActionListener

public function addActionListener(fuc:Function, obj:Object):Object

addActionListener(fuc:Function, obj:Object)
addActionListener(fuc:Function)

Adds a action listener to this button. Buttons fire a action event when user released on it.

Parameters

fucthe listener function.

Return

the listener just added.

See Also

addSelectionListener

public function addSelectionListener(func:Function, obj:Object):Object

addSelectionListener(fuc:Function, obj:Object)
addSelectionListener(fuc:Function)

Adds a action listener to this button's selection change event.

Parameters

Return

the listener just added.

See Also

setEnabled

public function setEnabled(b:Boolean):Void

Enabled (or disabled) the button.

Parameters

btrue to enable the button, otherwise false

Overrides

setEnabled() in org.aswing.Component

isSelected

public function isSelected():Boolean

Returns the state of the button. True if the toggle button is selected, false if it's not.

Return

true if the toggle button is selected, otherwise false

setSelected

public function setSelected(b:Boolean):Void

Sets the state of the button. Note that this method does not trigger an Event for users. Call doClick to perform a programatic action change.

Parameters

btrue if the button is selected, otherwise false

setRollOverEnabled

public function setRollOverEnabled(b:Boolean):Void

Sets the rolloverEnabled property, which must be true for rollover effects to occur. The default value for the rolloverEnabled property is false. Some look and feels might not implement rollover effects; they will ignore this property.

Parameters

bif true, rollover effects should be painted

See Also

isRollOverEnabled

public function isRollOverEnabled():Boolean

Gets the rolloverEnabled property.

Return

the value of the rolloverEnabled property

See Also

setMargin

public function setMargin(m:Insets):Void

Sets space for margin between the button's border and the label. Setting to null will cause the button to use the default margin. The button's default Border object will use this value to create the proper margin. However, if a non-default border is set on the button, it is that Border object's responsibility to create the appropriate margin space (else this property will effectively be ignored).

Parameters

mthe space between the border and the label

getMargin

public function getMargin():Insets

setContent

public function setContent(text:String, icon:Icon):Void

Sets text and icon at one method here.

Parameters

textthe text for the button
iconthe default icon for the button

See Also

setText

public function setText(text:String):Void

getText

public function getText():String

setIcon

public function setIcon(defaultIcon:Icon):Void

getIcon

public function getIcon():Icon

getPressedIcon

public function getPressedIcon():Icon

Returns the pressed icon for the button.

Return

the pressedIcon property

See Also

setPressedIcon

public function setPressedIcon(pressedIcon:Icon):Void

Sets the pressed icon for the button.

Parameters

pressedIconthe icon used as the "pressed" image

See Also

getSelectedIcon

public function getSelectedIcon():Icon

Returns the selected icon for the button.

Return

the selectedIcon property

See Also

setSelectedIcon

public function setSelectedIcon(selectedIcon:Icon):Void

Sets the selected icon for the button.

Parameters

selectedIconthe icon used as the "selected" image

See Also

getRollOverIcon

public function getRollOverIcon():Icon

Returns the rollover icon for the button.

Return

the rolloverIcon property

See Also

setRollOverIcon

public function setRollOverIcon(rolloverIcon:Icon):Void

Sets the rollover icon for the button.

Parameters

rolloverIconthe icon used as the "rollover" image

See Also

getRollOverSelectedIcon

public function getRollOverSelectedIcon():Icon

Returns the rollover selection icon for the button.

Return

the rolloverSelectedIcon property

See Also

setRollOverSelectedIcon

public function setRollOverSelectedIcon(rolloverSelectedIcon:Icon):Void

Sets the rollover selected icon for the button.

Parameters

rolloverSelectedIconthe icon used as the "selected rollover" image

See Also

getDisabledIcon

public function getDisabledIcon():Icon

Returns the icon used by the button when it's disabled. If no disabled icon has been set, the button constructs one from the default icon.

The disabled icon really should be created (if necessary) by the L&F.-->

Return

the disabledIcon property

See Also

setDisabledIcon

public function setDisabledIcon(disabledIcon:Icon):Void

Sets the disabled icon for the button.

Parameters

disabledIconthe icon used as the disabled image

See Also

getDisabledSelectedIcon

public function getDisabledSelectedIcon():Icon

Returns the icon used by the button when it's disabled and selected. If not no disabled selection icon has been set, the button constructs one from the selection icon.

The disabled selection icon really should be created (if necessary) by the L&F. -->

Return

the disabledSelectedIcon property

See Also

setDisabledSelectedIcon

public function setDisabledSelectedIcon(disabledSelectedIcon:Icon):Void

Sets the disabled selection icon for the button.

Parameters

disabledSelectedIconthe icon used as the disabled selection image

See Also

getVerticalAlignment

public function getVerticalAlignment():Number

Returns the vertical alignment of the text and icon.

Return

the verticalAlignment property, one of the following values:

  • ASWingConstants.CENTER (the default)
  • ASWingConstants.TOP
  • ASWingConstants.BOTTOM

setVerticalAlignment

public function setVerticalAlignment(alignment:Number):Void

Sets the vertical alignment of the icon and text.

Parameters

alignmentone of the following values:
  • ASWingConstants.CENTER (the default)
  • ASWingConstants.TOP
  • ASWingConstants.BOTTOM

getHorizontalAlignment

public function getHorizontalAlignment():Number

Returns the horizontal alignment of the icon and text.

Return

the horizontalAlignment property, one of the following values:

  • ASWingConstants.RIGHT (the default)
  • ASWingConstants.LEFT
  • ASWingConstants.CENTER

setHorizontalAlignment

public function setHorizontalAlignment(alignment:Number):Void

Sets the horizontal alignment of the icon and text.

Parameters

alignmentone of the following values:
  • ASWingConstants.RIGHT (the default)
  • ASWingConstants.LEFT
  • ASWingConstants.CENTER

getVerticalTextPosition

public function getVerticalTextPosition():Number

Returns the vertical position of the text relative to the icon.

Return

the verticalTextPosition property, one of the following values:

  • ASWingConstants.CENTER (the default)
  • ASWingConstants.TOP
  • ASWingConstants.BOTTOM

setVerticalTextPosition

public function setVerticalTextPosition(textPosition:Number):Void

Sets the vertical position of the text relative to the icon.

Parameters

getHorizontalTextPosition

public function getHorizontalTextPosition():Number

Returns the horizontal position of the text relative to the icon.

Return

the horizontalTextPosition property, one of the following values:

  • ASWingConstants.RIGHT (the default)
  • ASWingConstants.LEFT
  • ASWingConstants.CENTER

setHorizontalTextPosition

public function setHorizontalTextPosition(textPosition:Number):Void

Sets the horizontal position of the text relative to the icon.

Parameters

textPositionone of the following values:
  • ASWingConstants.RIGHT (the default)
  • ASWingConstants.LEFT
  • ASWingConstants.CENTER

getIconTextGap

public function getIconTextGap():Number

Returns the amount of space between the text and the icon displayed in this button.

Return

an int equal to the number of pixels between the text and the icon.

See Also

setIconTextGap

public function setIconTextGap(iconTextGap:Number):Void

If both the icon and text properties are set, this property defines the space between them.

The default value of this property is 4 pixels.

See Also