Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / ui / CQCursor.java @ 2312

History | View | Annotate | Download (2.7 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 * 
4
 * Copyright (C) 2004-5. 
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 2
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 * 
22
 * cresques@gmail.com
23
 */
24
package org.cresques.ui;
25

    
26
import java.awt.Cursor;
27
import java.awt.Point;
28
import java.awt.Toolkit;
29

    
30
/**
31
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
32
 */
33
public class CQCursor {
34
        public static int ZOOMIN_CURSOR        = 0x100;
35
        public static int ZOOMOUT_CURSOR        = 0x101;
36
        public static int PAN_CURSOR                = 0x102;
37
        public static int SELECT_CURSOR        = 0x103;
38
        public static int INFO_CURSOR                = 0x104;
39
        private static int MAXCURSORNR        = 15;
40
        private static Cursor [] cursores = null;
41
        
42
        static {
43
                ClassLoader loader = CQCursor.class.getClassLoader();
44
                //ImageIcon folderIcon = new ImageIcon(loader.getResource("images/"+"folderXP.gif"));
45
                cursores = new Cursor[MAXCURSORNR];
46
                cursores[ZOOMIN_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
47
                        Toolkit.getDefaultToolkit().getImage(loader.getResource("images/zi_cur.gif")),
48
                        new Point(6,5), "ZoomMas");
49
                cursores[ZOOMOUT_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
50
                        Toolkit.getDefaultToolkit().getImage(loader.getResource("images/zo_cur.gif")),
51
                        new Point(6,5), "ZoomMenos");
52
                cursores[PAN_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
53
                        Toolkit.getDefaultToolkit().getImage(loader.getResource("images/pan_cur.gif")),
54
                        new Point(3,3), "Pan");
55
                cursores[SELECT_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
56
                                Toolkit.getDefaultToolkit().getImage(loader.getResource("images/select_cur.gif")),
57
                                new Point(6,1), "Select");
58
                cursores[INFO_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
59
                                Toolkit.getDefaultToolkit().getImage(loader.getResource("images/info_cur.gif")),
60
                                new Point(5, 26), "Info");
61
        }
62
        
63
        public static Cursor getCursor(int type) {
64
                Cursor cursor = null;
65
                if (type < 0x100)
66
                        cursor = new Cursor(type);
67
                else if (type >= 0x100)
68
                        cursor = cursores[type - 0x100];
69
                return cursor;
70
                
71
        }
72
}