addActionListener
addActionListener: (AbstractButton, any) -> ()Adds an ActionListener (a table with actionPerformed, or a function of the event): it runs when the button is clicked, the last added first.
| Method | Returns | Description |
|---|---|---|
addActionListener(any) | () | Adds an ActionListener (a table with actionPerformed, or a function of the event): it runs when the button is clicked, the last added f… |
removeActionListener(any) | () | Removes an ActionListener, by identity. |
getActionListeners() | {any} | A copy of the ActionListeners, in registration order. |
addChangeListener(any) | () | Adds a ChangeListener (the button's model changed), the last added first. |
removeChangeListener(any) | () | Removes a ChangeListener, by identity. |
getText() | string? | The text, or nil. |
setText(string?) | () | Sets the text; a changed text lays the button out again. |
isSelected() | boolean | Whether a toggle, check box or radio button is selected. |
setSelected(boolean) | () | Selects or deselects it: when that changes, its ChangeListeners, then its ItemListeners, before this returns (they may not block on a d… |
doClick() | () | Clicks it now: pressed, released and its action, as a click does (its listeners run before this returns). |
getModel() | ButtonModel | The model's state (isPressed, isRollover, ...) and its change listeners. |
getActionCommand() | string? | The command its ActionEvents carry (the text, when none is set). |
setActionCommand(string?) | () | Sets the command its ActionEvents carry. |
getIcon() | Icon? | The icon, or nil. |
setIcon(any) | () | Shows icon (an ImageIcon or the plugin's own Icon table); nil removes it. |
setRolloverIcon(any) | () | The icon shown while the pointer is over it. |
setSelectedIcon(any) | () | The icon shown while it is selected. |
setRolloverSelectedIcon(any) | () | The icon shown while it is selected and the pointer is over it. |
setPressedIcon(any) | () | The icon shown while it is pressed. |
setDisabledIcon(any) | () | The icon shown while it is disabled; nil lets the look grey the icon. |
setIconTextGap(number) | () | The gap between the icon and the text. |
setHorizontalAlignment(number) | () | Aligns the icon and text horizontally (SwingConstants.LEFT, CENTER, RIGHT, LEADING, TRAILING). |
setFocusPainted(boolean) | () | Whether the look paints the focus ring. |
setBorderPainted(boolean) | () | Whether the look paints the border. |
setContentAreaFilled(boolean) | () | Whether the look fills the background. |
setRolloverEnabled(boolean) | () | Whether the pointer over it shows the rollover look and icon. |
addItemListener(any) | () | Adds an ItemListener (selected or deselected), the last added first. |
removeItemListener(any) | () | Removes an ItemListener, by identity. |
setUI(any) | () | BasicButtonUI.new() or BasicToggleButtonUI.new() installs Swing's basic look on the button; any other delegate is kept and changes noth… |
init(AbstractButton) | () | The implicit no-argument constructor: the fresh state a node of this kind starts with, and nothing more. Construction runs it as every nati… |
isInstance(any) | boolean | Whether obj is a AbstractButton object, a class(AbstractButton) subclass's included. |
| Field | Type | Description |
|---|---|---|
super | JComponentClass | JComponent's class table: the base class. |
addActionListeneraddActionListener: (AbstractButton, any) -> ()Adds an ActionListener (a table with actionPerformed, or a function of the event): it runs when the button is clicked, the last added first.
removeActionListenerremoveActionListener: (AbstractButton, any) -> ()Removes an ActionListener, by identity.
getActionListenersgetActionListeners: (AbstractButton) -> {any}A copy of the ActionListeners, in registration order.
addChangeListeneraddChangeListener: (AbstractButton, any) -> ()Adds a ChangeListener (the button's model changed), the last added first.
removeChangeListenerremoveChangeListener: (AbstractButton, any) -> ()Removes a ChangeListener, by identity.
getTextgetText: (AbstractButton) -> string?The text, or nil.
setTextsetText: (AbstractButton, string?) -> ()Sets the text; a changed text lays the button out again.
isSelectedisSelected: (AbstractButton) -> booleanWhether a toggle, check box or radio button is selected.
setSelectedsetSelected: (AbstractButton, boolean) -> ()Selects or deselects it: when that changes, its ChangeListeners, then its ItemListeners, before this returns (they may not block on a dialog).
doClickdoClick: (AbstractButton) -> ()Clicks it now: pressed, released and its action, as a click does (its listeners run before this returns).
getModelgetModel: (AbstractButton) -> ButtonModelThe model's state (isPressed, isRollover, ...) and its change listeners.
getActionCommandgetActionCommand: (AbstractButton) -> string?The command its ActionEvents carry (the text, when none is set).
setActionCommandsetActionCommand: (AbstractButton, string?) -> ()Sets the command its ActionEvents carry.
getIcongetIcon: (AbstractButton) -> Icon?The icon, or nil.
setIconsetIcon: (AbstractButton, any) -> ()Shows icon (an ImageIcon or the plugin's own Icon table); nil removes it.
setRolloverIconsetRolloverIcon: (AbstractButton, any) -> ()The icon shown while the pointer is over it.
setSelectedIconsetSelectedIcon: (AbstractButton, any) -> ()The icon shown while it is selected.
setRolloverSelectedIconsetRolloverSelectedIcon: (AbstractButton, any) -> ()The icon shown while it is selected and the pointer is over it.
setPressedIconsetPressedIcon: (AbstractButton, any) -> ()The icon shown while it is pressed.
setDisabledIconsetDisabledIcon: (AbstractButton, any) -> ()The icon shown while it is disabled; nil lets the look grey the icon.
setIconTextGapsetIconTextGap: (AbstractButton, number) -> ()The gap between the icon and the text.
setHorizontalAlignmentsetHorizontalAlignment: (AbstractButton, number) -> ()Aligns the icon and text horizontally (SwingConstants.LEFT, CENTER, RIGHT, LEADING, TRAILING).
setFocusPaintedsetFocusPainted: (AbstractButton, boolean) -> ()Whether the look paints the focus ring.
setBorderPaintedsetBorderPainted: (AbstractButton, boolean) -> ()Whether the look paints the border.
setContentAreaFilledsetContentAreaFilled: (AbstractButton, boolean) -> ()Whether the look fills the background.
setRolloverEnabledsetRolloverEnabled: (AbstractButton, boolean) -> ()Whether the pointer over it shows the rollover look and icon.
addItemListeneraddItemListener: (AbstractButton, any) -> ()Adds an ItemListener (selected or deselected), the last added first.
removeItemListenerremoveItemListener: (AbstractButton, any) -> ()Removes an ItemListener, by identity.
setUIsetUI: (AbstractButton, any) -> ()BasicButtonUI.new() or BasicToggleButtonUI.new() installs Swing's basic look on the button; any other delegate is kept and changes nothing.
initinit: (AbstractButton) -> ()The implicit no-argument constructor: the fresh state a node of this kind starts with, and nothing more. Construction runs it as every native base's super(); new does not take it.
isInstanceisInstance: (any) -> booleanWhether obj is a AbstractButton object, a class(AbstractButton) subclass's included.