APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.basic

public Class BasicButtonListener

extends Object
implements MouseListener, MouseMotionListener, FocusListener, ChangeListener, PropertyChangeListener
Class Inheritance
All Implemented Interfaces
java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.ChangeListener, java.awt.event.FocusListener, java.awt.event.MouseMotionListener, java.awt.event.MouseListener
Known Direct Subclasses
com.sun.java.swing.plaf.motif.MotifButtonListener
Imports
sun.swing.DefaultLookup, .SwingUtilities2, .UIAction, java.awt.*, java.awt.event.*, java.beans.*, javax.swing.*, javax.swing.event.*, javax.swing.plaf.ActionMapUIResource, .ButtonUI, .ComponentInputMapUIResource

Button Listener
Authors
Jeff Dinkins, Arnaud Weber (keyboard UI support)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
BasicButtonListener.Actions

Actions for Buttons.

Field Summary

Modifier and TypeField and Description
private long
private boolean

Constructor Summary

AccessConstructor and Description
public
BasicButtonListener(AbstractButton
an abstract button
b
)

Constructs a new instance of BasicButtonListener.

Method Summary

Modifier and TypeMethod and Description
protected void
checkOpacity(AbstractButton
an abstract button
b
)

Checks the opacity of the AbstractButton.

public void
focusGained(FocusEvent e)

Implements java.awt.event.FocusListener.focusGained.

Invoked when a component gains the keyboard focus.

public void
focusLost(FocusEvent e)

Implements java.awt.event.FocusListener.focusLost.

Invoked when a component loses the keyboard focus.

pack-priv InputMap
getInputMap(int condition, JComponent c)

Returns the InputMap for condition condition.

public void
installKeyboardActions(JComponent
a component
c
)

Register default key actions: pressing space to "click" a button and registering the keyboard mnemonic (if any).

pack-priv static void
loadActionMap(LazyActionMap map)

Populates Buttons actions.

public void
mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

public void
mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component and then dragged.

public void
mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

public void
mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

public void
mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

public void
mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

public void
mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

public void
propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

public void
stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

public void
uninstallKeyboardActions(JComponent
a component
c
)

Unregister default key actions.

pack-priv void
updateMnemonicBinding(AbstractButton b)

Resets the binding for the mnemonic in the WHEN_IN_FOCUSED_WINDOW UI InputMap.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastPressedTimestampback to summary
private long lastPressedTimestamp
shouldDiscardReleaseback to summary
private boolean shouldDiscardRelease

Constructor Detail

BasicButtonListenerback to summary
public BasicButtonListener(AbstractButton b)

Constructs a new instance of BasicButtonListener.

Parameters
b:AbstractButton

an abstract button

Method Detail

checkOpacityback to summary
protected void checkOpacity(AbstractButton b)

Checks the opacity of the AbstractButton.

Parameters
b:AbstractButton

an abstract button

focusGainedback to summary
public void focusGained(FocusEvent e)

Implements java.awt.event.FocusListener.focusGained.

Doc from java.awt.event.FocusListener.focusGained.

Invoked when a component gains the keyboard focus.

focusLostback to summary
public void focusLost(FocusEvent e)

Implements java.awt.event.FocusListener.focusLost.

Doc from java.awt.event.FocusListener.focusLost.

Invoked when a component loses the keyboard focus.

getInputMapback to summary
pack-priv InputMap getInputMap(int condition, JComponent c)

Returns the InputMap for condition condition. Called as part of installKeyboardActions.

installKeyboardActionsback to summary
public void installKeyboardActions(JComponent c)

Register default key actions: pressing space to "click" a button and registering the keyboard mnemonic (if any).

Parameters
c:JComponent

a component

loadActionMapback to summary
pack-priv static void loadActionMap(LazyActionMap map)

Populates Buttons actions.

mouseClickedback to summary
public void mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Doc from java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

mouseDraggedback to summary
public void mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Doc from java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation.

mouseEnteredback to summary
public void mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Doc from java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

mouseExitedback to summary
public void mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Doc from java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

mouseMovedback to summary
public void mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Doc from java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

mousePressedback to summary
public void mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Doc from java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

mouseReleasedback to summary
public void mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Doc from java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

propertyChangeback to summary
public void propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

stateChangedback to summary
public void stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Doc from javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

uninstallKeyboardActionsback to summary
public void uninstallKeyboardActions(JComponent c)

Unregister default key actions.

Parameters
c:JComponent

a component

updateMnemonicBindingback to summary
pack-priv void updateMnemonicBinding(AbstractButton b)

Resets the binding for the mnemonic in the WHEN_IN_FOCUSED_WINDOW UI InputMap.

javax.swing.plaf.basic back to summary

private Class BasicButtonListener.Actions

extends UIAction
Class Inheritance

Actions for Buttons. Two types of action are supported: pressed: Moves the button to a pressed state released: Disarms the button.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
accept(Object sender)

Overrides sun.swing.UIAction.accept.

Overrides default javax.swing.Action.accept.

Subclasses that need to conditionalize the enabled state should override this.

public void
actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

Inherited from sun.swing.UIAction:
addPropertyChangeListenergetNamegetValueisEnabledputValueremovePropertyChangeListenersetEnabled

Field Detail

PRESSback to summary
private static final String PRESS
RELEASEback to summary
private static final String RELEASE

Constructor Detail

Actionsback to summary
pack-priv Actions(String name)

Method Detail

acceptback to summary
public boolean accept(Object sender)

Overrides sun.swing.UIAction.accept.

Overrides default javax.swing.Action.accept.

Doc from sun.swing.UIAction.accept.

Subclasses that need to conditionalize the enabled state should override this. Be aware that sender may be null.

Annotations
@Override
actionPerformedback to summary
public void actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Doc from java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.