blob: a09d6a251e0724e82bee14fff311af77f444727f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package com.c2kernel.gui.graph.controller;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import com.c2kernel.gui.graph.view.GraphPanel;
public class AutoScrollController implements MouseMotionListener
{
private GraphPanel mGraphPanel = null;
public void setGraphPanel(GraphPanel graphPanel)
{
mGraphPanel = graphPanel;
mGraphPanel.addMouseMotionListener(this);
}
@Override
public void mouseDragged(MouseEvent me)
{
Point mousePoint = null;
if(mGraphPanel != null)
{
mousePoint = me.getPoint();
mGraphPanel.scrollRectToVisible(new Rectangle(mousePoint.x, mousePoint.y, 1, 1));
}
}
@Override
public void mouseMoved(MouseEvent me)
{
}
}
|