Package com.jidesoft.swing
Class AutoRepeatButtonUtils
- java.lang.Object
-
- com.jidesoft.swing.AutoRepeatButtonUtils
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.awt.event.MouseListener,java.util.EventListener
public class AutoRepeatButtonUtils extends java.lang.Object implements java.awt.event.ActionListener, java.awt.event.MouseListenerAutoRepeatButtonUtilsis a utility class which can make a button automatically trigger action events continuously. To enable this feature on any button, just call AutoRepeatButtonUtils.install(button) or AutoRepeatButtonUtils.install(button, delay, initialDelay).
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAUTO_REPEATstatic java.lang.StringCLIENT_PROPERTY_AUTO_REPEATstatic intDEFAULT_DELAYstatic intDEFAULT_INITIAL_DELAY
-
Constructor Summary
Constructors Constructor Description AutoRepeatButtonUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent event)static voidinstall(javax.swing.AbstractButton button)Enable auto-repeat feature on the button.static voidinstall(javax.swing.AbstractButton button, int delay, int initialDelay)Enable auto-repeat feature on the button.protected voidinstallListeners(javax.swing.AbstractButton button, int delay, int initialDelay)voidmouseClicked(java.awt.event.MouseEvent e)voidmouseEntered(java.awt.event.MouseEvent e)voidmouseExited(java.awt.event.MouseEvent e)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)static voiduninstall(javax.swing.AbstractButton button)Disabled the auto-repeat feature on the button which called install before.protected voiduninstallListeners()
-
-
-
Method Detail
-
install
public static void install(javax.swing.AbstractButton button)
Enable auto-repeat feature on the button.- Parameters:
button- the button.
-
install
public static void install(javax.swing.AbstractButton button, int delay, int initialDelay)Enable auto-repeat feature on the button.- Parameters:
button- the button.delay- the delay between action events, in ms.initialDelay- the initial delay, in ms. It is from the time mouse is pressed to the first action event.
-
uninstall
public static void uninstall(javax.swing.AbstractButton button)
Disabled the auto-repeat feature on the button which called install before.- Parameters:
button- the button that has auto-repeat feature.
-
installListeners
protected void installListeners(javax.swing.AbstractButton button, int delay, int initialDelay)
-
uninstallListeners
protected void uninstallListeners()
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
-