1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.gui.table;
21
22 import java.awt.Component;
23 import java.awt.Point;
24 import java.awt.dnd.DnDConstants;
25 import java.awt.dnd.DragGestureListener;
26 import java.awt.dnd.DragSource;
27 import java.awt.dnd.MouseDragGestureRecognizer;
28 import java.awt.event.MouseEvent;
29
30 public class MouseDragAdapter extends MouseDragGestureRecognizer
31 {
32
33
34
35
36
37 private int x;
38 private int y;
39 private MouseEvent event;
40
41
42
43 public MouseDragAdapter(DragSource ds, Component c, int actions,
44 DragGestureListener dgl)
45 {
46 super(ds, c, actions, dgl);
47 }
48
49
50
51 public void mouseClicked(MouseEvent e)
52 {
53
54 }
55
56 public void mouseDragged(MouseEvent e)
57 {
58 if (e.getX() < x - 15) {
59 if (event != null) {
60
61
62
63 appendEvent(event);
64 fireDragGestureRecognized(DnDConstants.ACTION_MOVE,
65 new Point(e.getX(), e.getY()));
66 }
67 }
68 }
69
70 public void mouseEntered(MouseEvent e)
71 {
72
73 }
74
75 public void mouseExited(MouseEvent e)
76 {
77
78 }
79
80 public void mouseMoved(MouseEvent e)
81 {
82
83 }
84
85 public void mousePressed(MouseEvent e)
86 {
87 x = e.getX();
88 y = e.getY();
89 event = e;
90 }
91
92 public void mouseReleased(MouseEvent e)
93 {
94 }
95
96 }