public class BasicSliderUI.TrackListener extends MouseInputAdapter
| Modifier and Type | Field and Description |
|---|---|
protected int |
currentMouseX
The current X position of the mouse.
|
protected int |
currentMouseY
The current Y position of the mouse.
|
protected int |
offset
The offset between the current slider value and the cursor's position.
|
| Constructor and Description |
|---|
BasicSliderUI.TrackListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
mouseDragged(MouseEvent e)
Called when the mouse has been dragged.
|
void |
mouseMoved(MouseEvent e)
Called when the mouse has moved over a component but no buttons have
been pressed yet.
|
void |
mousePressed(MouseEvent e)
Called when the mouse is pressed.
|
void |
mouseReleased(MouseEvent e)
Called when the mouse is released.
|
boolean |
shouldScroll(int direction)
Indicates whether the thumb should scroll in the given direction.
|
mouseClicked, mouseEntered, mouseExitedprotected int currentMouseX
protected int currentMouseY
protected int offset
public BasicSliderUI.TrackListener()
public void mouseDragged(MouseEvent e)
JSlider
accordingly.mouseDragged in interface MouseMotionListenermouseDragged in class MouseInputAdaptere - A MouseEventpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenermouseMoved in class MouseInputAdaptere - A MouseEventpublic void mousePressed(MouseEvent e)
JSlider should have its value set to where the
mouse was pressed. If the press occurs on the track, then the thumb
should move one block towards the direction of the mouse.mousePressed in interface MouseListenermousePressed in class MouseInputAdaptere - A MouseEventpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MouseInputAdaptere - A MouseEventpublic boolean shouldScroll(int direction)
direction - The direction to check.