Class SwingEventAdapter
java.lang.Object
javax.swing.InputVerifier
com.inductiveautomation.snap.swing.SwingEventAdapter
- All Implemented Interfaces:
DragGestureListener,DragSourceListener,DropTargetListener,ActionListener,FocusListener,KeyListener,MouseListener,MouseMotionListener,EventListener
- Direct Known Subclasses:
JComboBoxHpr.JComboBoxEventAdapter
public class SwingEventAdapter
extends InputVerifier
implements ActionListener, MouseListener, MouseMotionListener, KeyListener, FocusListener, DropTargetListener, DragGestureListener, DragSourceListener
A class to listen for Swing events and send them on.
-
Constructor Summary
ConstructorsConstructorDescriptionSwingEventAdapter(JComponent aComponent) Creates a new SwingEventAdapter for given component. -
Method Summary
Modifier and TypeMethodDescriptionvoidActionListener method.voiddragDropEnd(DragSourceDropEvent anEvent) DragSourceListener method.voiddragEnter(DragSourceDragEvent anEvent) DragSourceListener method.voiddragEnter(DropTargetDragEvent anEvent) Drop target listener method.voiddragExit(DragSourceEvent anEvent) DragSourceListener method.voiddragExit(DropTargetEvent anEvent) Drop target listener method.voiddragGestureRecognized(DragGestureEvent anEvent) Called when drag should be initiated due to mouse drag.voiddragOver(DragSourceDragEvent anEvent) DragSourceListener method.voiddragOver(DropTargetDragEvent anEvent) Drop target listener method.voiddrop(DropTargetDropEvent anEvent) Drop target listener method.voiddropActionChanged(DragSourceDragEvent anEvent) DragSourceListener method.voiddropActionChanged(DropTargetDragEvent anEvent) Drop target listener method.voidImplements focusGained to cache value prior to editing, so we know whether to fire action on focusLost/verify.voidImplements focus lost to verify (almost certainly not needed, since verify is called prior to focus lost).Returns the component border if it is currently being substituted with a temporary one.Returns the component.Returns an array of enabled events.Returns the value of the component when focus gained.Returns the component helper.booleanisEnabled(UIEvent.Type aType) Returns whether given type is enabled.booleanisEnabled(UIEvent.Type... theTypes) Returns whether any of given types are enabled.protected booleanReturns whether FocusListener is set.booleanReturns whether input verifier is set.protected booleanReturns whether KeyListener is set.protected booleanReturns whether MouseListener is set.protected booleanReturns whether MouseMotionListener is set.voidKeyListener method.voidKeyListener method.voidKeyListener method.voidMouseListener method.voidMouseMotionListener method.voidMouseListener method.voidMouseListener method.voidMouseMotionListener method.voidMouseListener method.voidMouseListener method.voidsetEnabled(UIEvent.Type aType, boolean aValue) Sets whether a given type is enabled.voidsetEnabledEvents(UIEvent.Type... theEvents) Sets an array of enabled events.protected voidsetFocusListenerSet(boolean aValue) Sets whether FocusListener is set.voidsetInputVerifier(boolean aValue) Sets Input verifier.protected voidsetKeyListenerSet(boolean aValue) Sets whether KeyListener is set.protected voidsetMouseListenerSet(boolean aValue) Sets whether MouseListener is set.protected voidsetMouseMotionListenerSet(boolean aValue) Sets whether MouseMotionListener is set.booleanverify(JComponent aComponent) Verify.Methods inherited from class javax.swing.InputVerifier
shouldYieldFocus, shouldYieldFocus, verifyTarget
-
Constructor Details
-
SwingEventAdapter
Creates a new SwingEventAdapter for given component.
-
-
Method Details
-
getComponent
Returns the component. -
getHelper
Returns the component helper. -
getBorder
Returns the component border if it is currently being substituted with a temporary one. -
isEnabled
Returns whether given type is enabled. -
isEnabled
Returns whether any of given types are enabled. -
setEnabled
Sets whether a given type is enabled. -
getEnabledEvents
Returns an array of enabled events. -
setEnabledEvents
Sets an array of enabled events. -
isKeyListenerSet
protected boolean isKeyListenerSet()Returns whether KeyListener is set. -
setKeyListenerSet
protected void setKeyListenerSet(boolean aValue) Sets whether KeyListener is set. -
isMouseListenerSet
protected boolean isMouseListenerSet()Returns whether MouseListener is set. -
setMouseListenerSet
protected void setMouseListenerSet(boolean aValue) Sets whether MouseListener is set. -
isMouseMotionListenerSet
protected boolean isMouseMotionListenerSet()Returns whether MouseMotionListener is set. -
setMouseMotionListenerSet
protected void setMouseMotionListenerSet(boolean aValue) Sets whether MouseMotionListener is set. -
isFocusListenerSet
protected boolean isFocusListenerSet()Returns whether FocusListener is set. -
setFocusListenerSet
protected void setFocusListenerSet(boolean aValue) Sets whether FocusListener is set. -
actionPerformed
ActionListener method.- Specified by:
actionPerformedin interfaceActionListener
-
keyPressed
KeyListener method.- Specified by:
keyPressedin interfaceKeyListener
-
keyTyped
KeyListener method.- Specified by:
keyTypedin interfaceKeyListener
-
keyReleased
KeyListener method.- Specified by:
keyReleasedin interfaceKeyListener
-
mousePressed
MouseListener method.- Specified by:
mousePressedin interfaceMouseListener
-
mouseDragged
MouseMotionListener method.- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseReleased
MouseListener method.- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseClicked
MouseListener method.- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
MouseListener method.- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseMoved
MouseMotionListener method.- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mouseExited
MouseListener method.- Specified by:
mouseExitedin interfaceMouseListener
-
focusGained
Implements focusGained to cache value prior to editing, so we know whether to fire action on focusLost/verify.- Specified by:
focusGainedin interfaceFocusListener
-
focusLost
Implements focus lost to verify (almost certainly not needed, since verify is called prior to focus lost).- Specified by:
focusLostin interfaceFocusListener
-
getFocusGainedValue
Returns the value of the component when focus gained. -
isInputVerifierSet
public boolean isInputVerifierSet()Returns whether input verifier is set. -
setInputVerifier
public void setInputVerifier(boolean aValue) Sets Input verifier. -
verify
Verify.- Specified by:
verifyin classInputVerifier
-
dragEnter
Drop target listener method.- Specified by:
dragEnterin interfaceDropTargetListener
-
dragOver
Drop target listener method.- Specified by:
dragOverin interfaceDropTargetListener
-
dropActionChanged
Drop target listener method.- Specified by:
dropActionChangedin interfaceDropTargetListener
-
dragExit
Drop target listener method.- Specified by:
dragExitin interfaceDropTargetListener
-
drop
Drop target listener method.- Specified by:
dropin interfaceDropTargetListener
-
dragGestureRecognized
Called when drag should be initiated due to mouse drag.- Specified by:
dragGestureRecognizedin interfaceDragGestureListener
-
dragEnter
DragSourceListener method.- Specified by:
dragEnterin interfaceDragSourceListener
-
dragOver
DragSourceListener method.- Specified by:
dragOverin interfaceDragSourceListener
-
dropActionChanged
DragSourceListener method.- Specified by:
dropActionChangedin interfaceDragSourceListener
-
dragExit
DragSourceListener method.- Specified by:
dragExitin interfaceDragSourceListener
-
dragDropEnd
DragSourceListener method.- Specified by:
dragDropEndin interfaceDragSourceListener
-