Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / graphic / listeners / GraphicListener.java @ 40561

History | View | Annotate | Download (2.77 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.graphic.listeners;
25

    
26
import java.awt.event.MouseEvent;
27
import java.awt.event.MouseListener;
28
import java.awt.event.MouseMotionListener;
29

    
30
import javax.swing.JLabel;
31
/**
32
 * @author Nacho Brodin <brodin_ign@gva.es>
33
 */
34
public class GraphicListener implements MouseListener, MouseMotionListener {
35
        private boolean move  = false;
36
        private JLabel  left  = null;
37
        private JLabel  right = null;
38

    
39
        public GraphicListener() {
40
        }
41

    
42
        public void setLabels(JLabel left, JLabel right){
43
                this.left = left;
44
                this.right = right;
45
        }
46

    
47
        /*
48
         * (non-Javadoc)
49
         * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
50
         */
51
        public void mouseDragged(MouseEvent e) {
52
                if (move) {
53
                        if (e.getSource() == left)
54
                                left.setLocation(left.getLocation().x + e.getX(), left.getLocation().y);
55

    
56
                        if (e.getSource() == right)
57
                                right.setLocation(right.getLocation().x + e.getX(), right.getLocation().y);
58
                }
59
        }
60

    
61
        /*
62
         * (non-Javadoc)
63
         * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
64
         */
65
        public void mousePressed(MouseEvent e) {
66
                move = true;
67
        }
68

    
69
        /*
70
         * (non-Javadoc)
71
         * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
72
         */
73
        public void mouseReleased(MouseEvent e) {
74
                move = false;
75
        }
76

    
77
        /*
78
         * (non-Javadoc)
79
         * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
80
         */
81
        public void mouseClicked(MouseEvent e) {
82
        }
83

    
84
        /*
85
         * (non-Javadoc)
86
         * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
87
         */
88
        public void mouseEntered(MouseEvent e) {
89
        }
90

    
91
        /*
92
         * (non-Javadoc)
93
         * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
94
         */
95
        public void mouseExited(MouseEvent e) {
96
        }
97

    
98
        /*
99
         * (non-Javadoc)
100
         * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
101
         */
102
        public void mouseMoved(MouseEvent e) {
103
        }
104
}