Class ActionRepeatableButtonModel
java.lang.Object
javax.swing.DefaultButtonModel
org.pushingpixels.radiance.component.api.common.model.ActionRepeatableButtonModel
- All Implemented Interfaces:
ItemSelectable, Serializable, ButtonModel, ActionButtonModel
Extension of the default button model that supports the
ActionButtonModel interface and repeated invocation of action
listeners on mouse rollover. This is the default core action model set on
JCommandButtons.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TimerTimer for the auto-repeat action mode.private JCommandButtonThe button behind the model.private booleanIndication whether the action is fired on mouse press (as opposed to mouse release).Fields inherited from class DefaultButtonModel
actionCommand, ARMED, changeEvent, ENABLED, group, listenerList, mnemonic, PRESSED, ROLLOVER, SELECTED, stateMask -
Constructor Summary
ConstructorsConstructorDescriptionActionRepeatableButtonModel(JCommandButton commandButton) Creates a new button model. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanChecks whether the action timer is running.booleanReturns indication whether the associated actions should be fired on mouse press instead of mouse release.booleanvoidsetFireActionOnPress(boolean toFireActionOnPress) Sets indication whether the associated actions should be fired on mouse press instead of mouse release.voidsetPressed(boolean b) voidsetRollover(boolean b) voidsetSelected(boolean b) private voidstartActionTimer(int modifiers) Starts the action timer, passing the specified modifiers to the action event that will be fired in a loop.private voidStop the action timer.Methods inherited from class DefaultButtonModel
addActionListener, addChangeListener, addItemListener, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getActionListeners, getChangeListeners, getGroup, getItemListeners, getListeners, getMnemonic, getSelectedObjects, isArmed, isEnabled, isPressed, isRollover, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setArmed, setEnabled, setGroup, setMnemonicMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ButtonModel
addActionListener, addChangeListener, addItemListener, getActionCommand, getMnemonic, isArmed, isEnabled, isPressed, isRollover, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setArmed, setEnabled, setGroup, setMnemonicMethods inherited from interface ItemSelectable
getSelectedObjects
-
Field Details
-
commandButton
The button behind the model. -
autoRepeatTimer
Timer for the auto-repeat action mode. -
toFireActionOnPress
private boolean toFireActionOnPressIndication whether the action is fired on mouse press (as opposed to mouse release).
-
-
Constructor Details
-
ActionRepeatableButtonModel
Creates a new button model.- Parameters:
commandButton- The associated command button.
-
-
Method Details
-
isSelected
public boolean isSelected()- Specified by:
isSelectedin interfaceButtonModel- Overrides:
isSelectedin classDefaultButtonModel
-
setSelected
public void setSelected(boolean b) - Specified by:
setSelectedin interfaceButtonModel- Overrides:
setSelectedin classDefaultButtonModel
-
setPressed
public void setPressed(boolean b) - Specified by:
setPressedin interfaceButtonModel- Overrides:
setPressedin classDefaultButtonModel
-
setRollover
public void setRollover(boolean b) - Specified by:
setRolloverin interfaceButtonModel- Overrides:
setRolloverin classDefaultButtonModel
-
stopActionTimer
private void stopActionTimer()Stop the action timer. -
isActionTimerRunning
private boolean isActionTimerRunning()Checks whether the action timer is running.- Returns:
trueif the action timer is running,falseotherwise.
-
startActionTimer
private void startActionTimer(int modifiers) Starts the action timer, passing the specified modifiers to the action event that will be fired in a loop.- Parameters:
modifiers- Modifiers for the action event to be fired.
-
isFireActionOnPress
public boolean isFireActionOnPress()Description copied from interface:ActionButtonModelReturns indication whether the associated actions should be fired on mouse press instead of mouse release.- Specified by:
isFireActionOnPressin interfaceActionButtonModel- Returns:
trueif the associated actions are fired on mouse press,falseif the associated actions are fired on mouse release.
-
setFireActionOnPress
public void setFireActionOnPress(boolean toFireActionOnPress) Description copied from interface:ActionButtonModelSets indication whether the associated actions should be fired on mouse press instead of mouse release.- Specified by:
setFireActionOnPressin interfaceActionButtonModel- Parameters:
toFireActionOnPress- iftrue, the associated actions will be fired on mouse press, otherwise the associated actions will be fired on mouse release.
-