root / trunk / libraries / libCq_CMS_praster / src / org / cresques / ui / CQCursor.java @ 8026
History | View | Annotate | Download (4.38 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 |
/**
|
32 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
33 |
*/
|
34 |
public class CQCursor { |
35 |
public static int ZOOMIN_CURSOR = 0x100; |
36 |
public static int ZOOMOUT_CURSOR = 0x101; |
37 |
public static int PAN_CURSOR = 0x102; |
38 |
public static int SELECT_CURSOR = 0x103; |
39 |
public static int INFO_CURSOR = 0x104; |
40 |
private static int MAXCURSORNR = 15; |
41 |
private static Cursor[] cursores = null; |
42 |
|
43 |
static {
|
44 |
ClassLoader loader = CQCursor.class.getClassLoader();
|
45 |
|
46 |
//ImageIcon folderIcon = new ImageIcon(loader.getResource("images/"+"folderXP.gif"));
|
47 |
cursores = new Cursor[MAXCURSORNR]; |
48 |
cursores[ZOOMIN_CURSOR - 0x100] = Toolkit.getDefaultToolkit() |
49 |
.createCustomCursor(Toolkit.getDefaultToolkit()
|
50 |
.getImage(loader.getResource("images/zi_cur.gif")),
|
51 |
new Point(6, |
52 |
5),
|
53 |
"ZoomMas");
|
54 |
cursores[ZOOMOUT_CURSOR - 0x100] = Toolkit.getDefaultToolkit() |
55 |
.createCustomCursor(Toolkit.getDefaultToolkit()
|
56 |
.getImage(loader.getResource("images/zo_cur.gif")),
|
57 |
new Point(6, |
58 |
5),
|
59 |
"ZoomMenos");
|
60 |
cursores[PAN_CURSOR - 0x100] = Toolkit.getDefaultToolkit() |
61 |
.createCustomCursor(Toolkit.getDefaultToolkit()
|
62 |
.getImage(loader.getResource("images/pan_cur.gif")),
|
63 |
new Point(3, 3), |
64 |
"Pan");
|
65 |
cursores[SELECT_CURSOR - 0x100] = Toolkit.getDefaultToolkit() |
66 |
.createCustomCursor(Toolkit.getDefaultToolkit()
|
67 |
.getImage(loader.getResource("images/select_cur.gif")),
|
68 |
new Point(6, |
69 |
1),
|
70 |
"Select");
|
71 |
cursores[INFO_CURSOR - 0x100] = Toolkit.getDefaultToolkit() |
72 |
.createCustomCursor(Toolkit.getDefaultToolkit()
|
73 |
.getImage(loader.getResource("images/info_cur.gif")),
|
74 |
new Point(5, |
75 |
26),
|
76 |
"Info");
|
77 |
} |
78 |
|
79 |
public static Cursor getCursor(int type) { |
80 |
Cursor cursor = null; |
81 |
|
82 |
if (type < 0x100) { |
83 |
cursor = new Cursor(type); |
84 |
} else if (type >= 0x100) { |
85 |
cursor = cursores[type - 0x100];
|
86 |
} |
87 |
|
88 |
return cursor;
|
89 |
} |
90 |
} |