Package org.esa.snap.rcp.quicklooks
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 Summary
Fields Modifier and Type Field Description static int
DRAGABLE_HORIZONTAL_SCROLL_BAR
static int
DRAGABLE_VERTICAL_SCROLL_BAR
-
Constructor Summary
Constructors Constructor Description DragScrollListener(Component c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
mouseClicked(MouseEvent e)
Empty implementationvoid
mouseDragged(MouseEvent e)
MouseDragged implementation.void
mouseEntered(MouseEvent e)
Empty implementationvoid
mouseExited(MouseEvent e)
Empty implementationvoid
mouseMoved(MouseEvent e)
Emptyvoid
mousePressed(MouseEvent e)
Mouse pressed implementationvoid
mouseReleased(MouseEvent e)
Mouse released implementation.void
setAnimationTiming(int timing)
Sets how frequently the animation will occur in milliseconds.void
setDamping(double damping)
Sets the animation damping.void
setDraggableElements(int mask)
Sets the Draggable elements - the Horizontal or Vertical Direction.void
setScrollingIntensity(int intensity)
Sets the scrolling intensity - the default value being 5.
-
-
-
Field Detail
-
DRAGABLE_HORIZONTAL_SCROLL_BAR
public static final int DRAGABLE_HORIZONTAL_SCROLL_BAR
- See Also:
- Constant Field Values
-
DRAGABLE_VERTICAL_SCROLL_BAR
public static final int DRAGABLE_VERTICAL_SCROLL_BAR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DragScrollListener
public DragScrollListener(Component c)
-
-
Method Detail
-
setDraggableElements
public void setDraggableElements(int mask)
Sets the Draggable elements - the Horizontal or Vertical Direction. Onecan 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 aninverse 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. Defaultvalue 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 interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
Empty implementation- Specified by:
mouseExited
in interfaceMouseListener
-
mousePressed
public void mousePressed(MouseEvent e)
Mouse pressed implementation- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
public void mouseReleased(MouseEvent e)
Mouse released implementation. This determines if further animationis necessary and launches the appropriate times.
- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseClicked
public void mouseClicked(MouseEvent e)
Empty implementation- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseDragged
public void mouseDragged(MouseEvent e)
MouseDragged implementation. Sets up timing and frame animation.- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseMoved
public void mouseMoved(MouseEvent e)
Empty- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
-