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 ChartControlchart - the displayed chartpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved in interface MouseWheelListenerpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic int getMovementMouseButton()
MouseEvent.BUTTON1MouseEvent.BUTTON2MouseEvent.BUTTON3public MoveLineChartByMouseListener movementMouseButton(int newMovementMouseButton)
MouseEvent.BUTTON1MouseEvent.BUTTON2MouseEvent.BUTTON3newMovementMouseButton - the mouse buttonpublic void setMovementMouseButton(int movementMouseButton)
MouseEvent.BUTTON1MouseEvent.BUTTON2MouseEvent.BUTTON3movementMouseButton - the mouse buttonCopyright © 2020. All rights reserved.