svn-gvsig-desktop / tags / Root_CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / ui / CQCursor.java @ 1732
History | View | Annotate | Download (1.85 KB)
1 |
/*
|
---|---|
2 |
* Creado el 24-ago-2004
|
3 |
*/
|
4 |
package org.cresques.ui; |
5 |
|
6 |
import java.awt.Cursor; |
7 |
import java.awt.Point; |
8 |
import java.awt.Toolkit; |
9 |
|
10 |
/**
|
11 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
12 |
*/
|
13 |
public class CQCursor { |
14 |
public static int ZOOMIN_CURSOR = 0x100; |
15 |
public static int ZOOMOUT_CURSOR = 0x101; |
16 |
public static int PAN_CURSOR = 0x102; |
17 |
public static int SELECT_CURSOR = 0x103; |
18 |
public static int INFO_CURSOR = 0x104; |
19 |
private static int MAXCURSORNR = 15; |
20 |
private static Cursor [] cursores = null; |
21 |
|
22 |
static {
|
23 |
ClassLoader loader = CQCursor.class.getClassLoader();
|
24 |
//ImageIcon folderIcon = new ImageIcon(loader.getResource("images/"+"folderXP.gif"));
|
25 |
cursores = new Cursor[MAXCURSORNR]; |
26 |
cursores[ZOOMIN_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor( |
27 |
Toolkit.getDefaultToolkit().getImage(loader.getResource("images/zi_cur.gif")), |
28 |
new Point(6,5), "ZoomMas"); |
29 |
cursores[ZOOMOUT_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor( |
30 |
Toolkit.getDefaultToolkit().getImage(loader.getResource("images/zo_cur.gif")), |
31 |
new Point(6,5), "ZoomMenos"); |
32 |
cursores[PAN_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor( |
33 |
Toolkit.getDefaultToolkit().getImage(loader.getResource("images/pan_cur.gif")), |
34 |
new Point(3,3), "Pan"); |
35 |
cursores[SELECT_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor( |
36 |
Toolkit.getDefaultToolkit().getImage(loader.getResource("images/select_cur.gif")), |
37 |
new Point(6,1), "Select"); |
38 |
cursores[INFO_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor( |
39 |
Toolkit.getDefaultToolkit().getImage(loader.getResource("images/info_cur.gif")), |
40 |
new Point(5, 26), "Info"); |
41 |
} |
42 |
|
43 |
public static Cursor getCursor(int type) { |
44 |
Cursor cursor = null; |
45 |
if (type < 0x100) |
46 |
cursor = new Cursor(type); |
47 |
else if (type >= 0x100) |
48 |
cursor = cursores[type - 0x100];
|
49 |
return cursor;
|
50 |
|
51 |
} |
52 |
} |