/Users/lyon/j4p/src/gui/mouse/MouseComponentMover.java
|
1 package gui.mouse;
2
3
4 public class MouseComponentMover extends gui.mouse.MouseController {
5 java.awt.Component c;
6
7 public MouseComponentMover(java.awt.Component _c) {
8 c = _c;
9 c.setCursor(java.awt.Cursor.getPredefinedCursor(
10 java.awt.Cursor.HAND_CURSOR));
11 c.addMouseMotionListener(this);
12 c.addMouseListener(this);
13 }
14
15 public void dragShift(java.awt.Point p1, java.awt.Point p2) {
16 javax.swing.SwingUtilities.convertPointToScreen(p2, c);
17 c.setSize(p2.x - c.getBounds().x, p2.y - c.getBounds().y);
18 c.setCursor(java.awt.Cursor.getPredefinedCursor(
19 java.awt.Cursor.SE_RESIZE_CURSOR));
20 }
21
22 public void dragged(java.awt.Point p1, java.awt.Point p2) {
23 c.setCursor(java.awt.Cursor.getPredefinedCursor(
24 java.awt.Cursor.HAND_CURSOR));
25 javax.swing.SwingUtilities.convertPointToScreen(p2, c);
26 c.setLocation(p2.x, p2.y);
27 }
28
29 public void clicked(java.awt.Point p) {
30 }
31
32 public void shiftClicked(java.awt.Point p) {
33 }
34
35 public void pressed(java.awt.Point p) {
36 }
37
38 public void doubleClicked(java.awt.Point p) {
39 }
40
41 public void released(java.awt.Point p) {
42 c.setCursor(java.awt.Cursor.getPredefinedCursor(
43 java.awt.Cursor.HAND_CURSOR));
44 }
45 }