class org.aswing.AbstractButton extends Component
Sub classes | ||||||||||
![]() | JButton, JLabelButton, JMenuItem, JToggleButton |
|
Defines common behaviors for buttons and menu items.
@author paling @author ngrebenshikov
![]() | Show Events | Hide Events
|
Class Fields
Instance Fields
var displayText:String
The text to be displayed, it is a text that removed the "&"(mnemonic modifier char).
The horizontal alignment of the icon and text.
One of the following values:
org.aswing.AsWingConstants.RIGHT
(the default)org.aswing.AsWingConstants.LEFT
org.aswing.AsWingConstants.CENTER
var horizontalTextPosition:Int
The horizontal position of the text relative to the icon.
One of the following values:
org.aswing.AsWingConstants.RIGHT
(the default)org.aswing.AsWingConstants.LEFT
org.aswing.AsWingConstants.CENTER
var iconTextGap:Int
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.
The 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).
The keyboard mnemonic for this button, -1 means no mnemonic. @see #text @see #displayText @see #mnemonicIndex
var mnemonicIndex:Int
The mnemonic char index in the display text, -1 means no mnemonic. @see #text @see #displayText @see #mnemonic
The state of the button.
Note that setting does not trigger ACT
Event for users (will of course trigger STATE_CHANGED
event).
Call this.doClick()
to perform a programatic action change.
var shiftOffsetSet:Bool
Whether or not the shiftOffset has set by user. The LAF will not change this value if it is true.
The vertical position of the text relative to the icon. One of the following values:
org.aswing.AsWingConstants.CENTER
(the default)org.aswing.AsWingConstants.TOP
org.aswing.AsWingConstants.BOTTOM
function addActionListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Adds a action listener to this button. Buttons fire a action event when user clicked on it.
See org.aswing.event.AWEvent#ACT
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
function addSelectionListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Add a listener to listen the button's selection change event. When the button's selection changed, fired when diselected or selected.
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak.
See |
function addStateListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Adds a listener to listen the button's state change event.
When the button's state changed, the state is all about:
@see org.aswing.event.InteractiveEvent#STATE_CHANGEDlistener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
function removeActionListener(listener:Dynamic ->Void): Void
Removes a action listener.
listener | the listener to be removed. |
function removeSelectionListener(listener:Dynamic ->Void): Void
Removes a selection listener.
listener | the listener to be removed.
See |
function removeStateListener(listener:Dynamic ->Void): Void
Removes a state listener. @see org.aswing.event.InteractiveEvent#STATE_CHANGED
listener | the listener to be removed. |
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)));
function wrapSimpleButton(btn:SimpleButton): AbstractButton
Wrap a SimpleButton to be this button's representation.
btn | the SimpleButton to be wrap. |
returns | the button self |