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

A class to listen for Swing events and send them on.
  • Constructor Details

    • SwingEventAdapter

      public SwingEventAdapter(JComponent aComponent)
      Creates a new SwingEventAdapter for given component.
  • Method Details

    • getComponent

      public JComponent getComponent()
      Returns the component.
    • getHelper

      public JComponentHpr getHelper()
      Returns the component helper.
    • getBorder

      public Border getBorder()
      Returns the component border if it is currently being substituted with a temporary one.
    • isEnabled

      public boolean isEnabled(UIEvent.Type aType)
      Returns whether given type is enabled.
    • isEnabled

      public boolean isEnabled(UIEvent.Type... theTypes)
      Returns whether any of given types are enabled.
    • setEnabled

      public void setEnabled(UIEvent.Type aType, boolean aValue)
      Sets whether a given type is enabled.
    • getEnabledEvents

      public UIEvent.Type[] getEnabledEvents()
      Returns an array of enabled events.
    • setEnabledEvents

      public void setEnabledEvents(UIEvent.Type... theEvents)
      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

      public void actionPerformed(ActionEvent e)
      ActionListener method.
      Specified by:
      actionPerformed in interface ActionListener
    • keyPressed

      public void keyPressed(KeyEvent e)
      KeyListener method.
      Specified by:
      keyPressed in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent e)
      KeyListener method.
      Specified by:
      keyTyped in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent e)
      KeyListener method.
      Specified by:
      keyReleased in interface KeyListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      MouseListener method.
      Specified by:
      mousePressed in interface MouseListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      MouseMotionListener method.
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      MouseListener method.
      Specified by:
      mouseReleased in interface MouseListener
    • mouseClicked

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

      public void mouseEntered(MouseEvent e)
      MouseListener method.
      Specified by:
      mouseEntered in interface MouseListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      MouseMotionListener method.
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      MouseListener method.
      Specified by:
      mouseExited in interface MouseListener
    • focusGained

      public void focusGained(FocusEvent e)
      Implements focusGained to cache value prior to editing, so we know whether to fire action on focusLost/verify.
      Specified by:
      focusGained in interface FocusListener
    • focusLost

      public void focusLost(FocusEvent e)
      Implements focus lost to verify (almost certainly not needed, since verify is called prior to focus lost).
      Specified by:
      focusLost in interface FocusListener
    • getFocusGainedValue

      public Object 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

      public boolean verify(JComponent aComponent)
      Verify.
      Specified by:
      verify in class InputVerifier
    • dragEnter

      public void dragEnter(DropTargetDragEvent anEvent)
      Drop target listener method.
      Specified by:
      dragEnter in interface DropTargetListener
    • dragOver

      public void dragOver(DropTargetDragEvent anEvent)
      Drop target listener method.
      Specified by:
      dragOver in interface DropTargetListener
    • dropActionChanged

      public void dropActionChanged(DropTargetDragEvent anEvent)
      Drop target listener method.
      Specified by:
      dropActionChanged in interface DropTargetListener
    • dragExit

      public void dragExit(DropTargetEvent anEvent)
      Drop target listener method.
      Specified by:
      dragExit in interface DropTargetListener
    • drop

      public void drop(DropTargetDropEvent anEvent)
      Drop target listener method.
      Specified by:
      drop in interface DropTargetListener
    • dragGestureRecognized

      public void dragGestureRecognized(DragGestureEvent anEvent)
      Called when drag should be initiated due to mouse drag.
      Specified by:
      dragGestureRecognized in interface DragGestureListener
    • dragEnter

      public void dragEnter(DragSourceDragEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragEnter in interface DragSourceListener
    • dragOver

      public void dragOver(DragSourceDragEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragOver in interface DragSourceListener
    • dropActionChanged

      public void dropActionChanged(DragSourceDragEvent anEvent)
      DragSourceListener method.
      Specified by:
      dropActionChanged in interface DragSourceListener
    • dragExit

      public void dragExit(DragSourceEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragExit in interface DragSourceListener
    • dragDropEnd

      public void dragDropEnd(DragSourceDropEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragDropEnd in interface DragSourceListener