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, mouseExited
protected int currentMouseX
protected int currentMouseY
protected int offset
public BasicSliderUI.TrackListener()
public void mouseDragged(MouseEvent e)
JSlider
accordingly.mouseDragged
in interface MouseMotionListener
mouseDragged
in class MouseInputAdapter
e
- A MouseEvent
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class MouseInputAdapter
e
- A MouseEvent
public 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 MouseListener
mousePressed
in class MouseInputAdapter
e
- A MouseEvent
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseInputAdapter
e
- A MouseEvent
public boolean shouldScroll(int direction)
direction
- The direction to check.