public class MoveLineChartByMouseListener extends Object implements MouseListener, MouseMotionListener, MouseWheelListener
MouseListener
, MouseMotionListener
and MouseWheelListener
to
move the diagram with the mouse. It's advised to add this listener by using the
hookToControl(Component, LineChart)
method.Constructor and Description |
---|
MoveLineChartByMouseListener(LineChart chart)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getMovementMouseButton()
Returns the button that needs to be pressed to move the chart.
|
static MoveLineChartByMouseListener |
hookToControl(Component control,
LineChart chart)
Creates a new
MoveLineChartByMouseListener , hooks it to a control (not
necessary a ChartControl , but that's probably a good idea) and returns the
brand new instance. |
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
mouseWheelMoved(MouseWheelEvent e) |
MoveLineChartByMouseListener |
movementMouseButton(int newMovementMouseButton)
Sets the button that needs to be pressed to move the chart.
|
void |
setMovementMouseButton(int movementMouseButton)
Sets the button that needs to be pressed to move the chart.
|
public MoveLineChartByMouseListener(LineChart chart)
chart
- the chart this listener usespublic static MoveLineChartByMouseListener hookToControl(Component control, LineChart chart)
MoveLineChartByMouseListener
, hooks it to a control (not
necessary a ChartControl
, but that's probably a good idea) and returns the
brand new instance.control
- the control, probably a ChartControl
chart
- the displayed chartpublic void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public int getMovementMouseButton()
MouseEvent.BUTTON1
MouseEvent.BUTTON2
MouseEvent.BUTTON3
public MoveLineChartByMouseListener movementMouseButton(int newMovementMouseButton)
MouseEvent.BUTTON1
MouseEvent.BUTTON2
MouseEvent.BUTTON3
newMovementMouseButton
- the mouse buttonpublic void setMovementMouseButton(int movementMouseButton)
MouseEvent.BUTTON1
MouseEvent.BUTTON2
MouseEvent.BUTTON3
movementMouseButton
- the mouse buttonCopyright © 2020. All rights reserved.