Class AutoRepeatButtonUtils

java.lang.Object
com.jidesoft.swing.AutoRepeatButtonUtils
All Implemented Interfaces:
ActionListener, MouseListener, EventListener

public class AutoRepeatButtonUtils extends Object implements ActionListener, 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 Details

    • AUTO_REPEAT

      public static String AUTO_REPEAT
    • CLIENT_PROPERTY_AUTO_REPEAT

      public static String CLIENT_PROPERTY_AUTO_REPEAT
    • DEFAULT_DELAY

      public static int DEFAULT_DELAY
    • DEFAULT_INITIAL_DELAY

      public static int DEFAULT_INITIAL_DELAY
  • Constructor Details

    • AutoRepeatButtonUtils

      public AutoRepeatButtonUtils()
  • Method Details

    • install

      public static void install(AbstractButton button)
      Enable auto-repeat feature on the button.
      Parameters:
      button - the button.
    • install

      public static void install(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(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(AbstractButton button, int delay, int initialDelay)
    • uninstallListeners

      protected void uninstallListeners()
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Specified by:
      actionPerformed in interface ActionListener