com.jgoodies.looks.common
Class ExtBasicArrowButtonHandler

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.jgoodies.looks.common.ExtBasicArrowButtonHandler
All Implemented Interfaces:
ActionListener, FocusListener, MouseListener, Serializable, Cloneable, EventListener, Action

public final class ExtBasicArrowButtonHandler
extends AbstractAction
implements MouseListener, FocusListener

A handler for spinner arrow button mouse and action events. When a left mouse pressed event occurs we look up the (enabled) spinner that's the source of the event and start the autorepeat timer. The timer fires action events until any button is released at which point the timer is stopped and the reference to the spinner cleared. The timer doesn't start until after a 300ms delay, so often the source of the initial (and final) action event is just the button logic for mouse released - which means that we're relying on the fact that our mouse listener runs after the buttons mouse listener.

Note that one instance of this handler is shared by all slider previous arrow buttons and likewise for all of the next buttons, so it doesn't have any state that persists beyond the limits of a single button pressed/released gesture.

Copied from javax.swing.BasicSpinnerUI

Version:
$Revision: 1.4 $
See Also:
BasicSpinnerUI, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
ExtBasicArrowButtonHandler(String name, boolean isNext)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void focusGained(FocusEvent e)
           
 void focusLost(FocusEvent e)
           
 void mouseClicked(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtBasicArrowButtonHandler

public ExtBasicArrowButtonHandler(String name,
                                  boolean isNext)
Method Detail

actionPerformed

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

mousePressed

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

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased 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

mouseExited

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

focusGained

public void focusGained(FocusEvent e)
Specified by:
focusGained in interface FocusListener

focusLost

public void focusLost(FocusEvent e)
Specified by:
focusLost in interface FocusListener


Copyright © 2001-2007 JGoodies Karsten Lentzsch. All Rights Reserved.