Class DragScrollListener

java.lang.Object
org.esa.snap.rcp.quicklooks.DragScrollListener
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener

public class DragScrollListener extends Object implements MouseListener, MouseMotionListener
Listener to allow for iPhone like drag scrolling of a Component within a JScrollPane.
  • Field Details

    • DRAGABLE_HORIZONTAL_SCROLL_BAR

      public static final int DRAGABLE_HORIZONTAL_SCROLL_BAR
      See Also:
    • DRAGABLE_VERTICAL_SCROLL_BAR

      public static final int DRAGABLE_VERTICAL_SCROLL_BAR
      See Also:
  • Constructor Details

    • DragScrollListener

      public DragScrollListener(Component c)
  • Method Details

    • setDraggableElements

      public void setDraggableElements(int mask)
      Sets the Draggable elements - the Horizontal or Vertical Direction. One

      can use a bitmasked 'or' (HORIZONTAL_SCROLL_BAR | VERTICAL_SCROLL_BAR ).

      Parameters:
      mask - One of HORIZONTAL_SCROLL_BAR, VERTICAL_SCROLL_BAR, or HORIZONTAL_SCROLL_BAR | VERTICAL_SCROLL_BAR
    • setScrollingIntensity

      public void setScrollingIntensity(int intensity)
      Sets the scrolling intensity - the default value being 5. Note, that this has an

      inverse relationship to intensity (1 has the biggest difference, higher numbers having

      less impact).

      Parameters:
      intensity - The new intensity value (Note the inverse relationship).
    • setAnimationTiming

      public void setAnimationTiming(int timing)
      Sets how frequently the animation will occur in milliseconds. Default

      value is 30 milliseconds. 60+ will get a bit flickery.

      Parameters:
      timing - The timing, in milliseconds.
    • setDamping

      public void setDamping(double damping)
      Sets the animation damping.
      Parameters:
      damping - The new value
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Empty implementation
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Empty implementation
      Specified by:
      mouseExited in interface MouseListener
    • mousePressed

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

      public void mouseReleased(MouseEvent e)
      Mouse released implementation. This determines if further animation

      is necessary and launches the appropriate times.

      Specified by:
      mouseReleased in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Empty implementation
      Specified by:
      mouseClicked in interface MouseListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      MouseDragged implementation. Sets up timing and frame animation.
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Empty
      Specified by:
      mouseMoved in interface MouseMotionListener