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.MouseListener
AutoRepeatButtonUtils
is 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.String
AUTO_REPEAT
static java.lang.String
CLIENT_PROPERTY_AUTO_REPEAT
static int
DEFAULT_DELAY
static int
DEFAULT_INITIAL_DELAY
-
Constructor Summary
Constructors Constructor Description AutoRepeatButtonUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
static void
install(javax.swing.AbstractButton button)
Enable auto-repeat feature on the button.static void
install(javax.swing.AbstractButton button, int delay, int initialDelay)
Enable auto-repeat feature on the button.protected void
installListeners(javax.swing.AbstractButton button, int delay, int initialDelay)
void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
void
mouseReleased(java.awt.event.MouseEvent e)
static void
uninstall(javax.swing.AbstractButton button)
Disabled the auto-repeat feature on the button which called install before.protected void
uninstallListeners()
-
-
-
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:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
-