home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.io.File;
- import java.io.Serializable;
- import java.security.AccessController;
- import java.util.Hashtable;
- import java.util.Properties;
- import java.util.StringTokenizer;
- import sun.security.action.GetPropertyAction;
-
- public class Cursor implements Serializable {
- public static final int DEFAULT_CURSOR = 0;
- public static final int CROSSHAIR_CURSOR = 1;
- public static final int TEXT_CURSOR = 2;
- public static final int WAIT_CURSOR = 3;
- public static final int SW_RESIZE_CURSOR = 4;
- public static final int SE_RESIZE_CURSOR = 5;
- public static final int NW_RESIZE_CURSOR = 6;
- public static final int NE_RESIZE_CURSOR = 7;
- public static final int N_RESIZE_CURSOR = 8;
- public static final int S_RESIZE_CURSOR = 9;
- public static final int W_RESIZE_CURSOR = 10;
- public static final int E_RESIZE_CURSOR = 11;
- public static final int HAND_CURSOR = 12;
- public static final int MOVE_CURSOR = 13;
- protected static Cursor[] predefined = new Cursor[14];
- static final String[][] cursorProperties = new String[][]{{"AWT.DefaultCursor", "Default Cursor"}, {"AWT.CrosshairCursor", "Crosshair Cursor"}, {"AWT.TextCursor", "Text Cursor"}, {"AWT.WaitCursor", "Wait Cursor"}, {"AWT.SWResizeCursor", "Southwest Resize Cursor"}, {"AWT.SEResizeCursor", "Southeast Resize Cursor"}, {"AWT.NWResizeCursor", "Northwest Resize Cursor"}, {"AWT.NEResizeCursor", "Northeast Resize Cursor"}, {"AWT.NResizeCursor", "North Resize Cursor"}, {"AWT.SResizeCursor", "South Resize Cursor"}, {"AWT.WResizeCursor", "West Resize Cursor"}, {"AWT.EResizeCursor", "East Resize Cursor"}, {"AWT.HandCursor", "Hand Cursor"}, {"AWT.MoveCursor", "Move Cursor"}};
- int type = 0;
- public static final int CUSTOM_CURSOR = -1;
- private static final Hashtable systemCustomCursors = new Hashtable(1);
- private static final String systemCustomCursorDirPrefix = initCursorDir();
- private static final String systemCustomCursorPropertiesFile;
- private static Properties systemCustomCursorProperties;
- private static final String CursorDotPrefix = "Cursor.";
- private static final String DotFileSuffix = ".File";
- private static final String DotHotspotSuffix = ".HotSpot";
- private static final String DotNameSuffix = ".Name";
- private static final long serialVersionUID = 8028237497568985504L;
- private transient long pData;
- protected String name;
-
- private static String initCursorDir() {
- String var0 = (String)AccessController.doPrivileged(new GetPropertyAction("java.home"));
- return var0 + File.separator + "lib" + File.separator + "images" + File.separator + "cursors" + File.separator;
- }
-
- private static native void initIDs();
-
- public static Cursor getPredefinedCursor(int var0) {
- if (var0 >= 0 && var0 <= 13) {
- if (predefined[var0] == null) {
- predefined[var0] = new Cursor(var0);
- }
-
- return predefined[var0];
- } else {
- throw new IllegalArgumentException("illegal cursor type");
- }
- }
-
- public static Cursor getSystemCustomCursor(String var0) throws AWTException {
- Cursor var1 = (Cursor)systemCustomCursors.get(var0);
- if (var1 == null) {
- Hashtable var2 = systemCustomCursors;
- synchronized(var2) {
- if (systemCustomCursorProperties == null) {
- loadSystemCustomCursorProperties();
- }
- }
-
- String var3 = "Cursor." + var0;
- String var4 = var3 + ".File";
- if (!systemCustomCursorProperties.containsKey(var4)) {
- System.err.println("Cursor.getSystemCustomCursor(" + var0 + ") returned null");
- return null;
- }
-
- String var5 = systemCustomCursorProperties.getProperty(var4);
- String var6 = systemCustomCursorProperties.getProperty(var3 + ".Name");
- if (var6 == null) {
- var6 = var0;
- }
-
- String var7 = systemCustomCursorProperties.getProperty(var3 + ".HotSpot");
- if (var7 == null) {
- throw new AWTException("no hotspot property defined for cursor: " + var0);
- }
-
- StringTokenizer var8 = new StringTokenizer(var7, ",");
- if (var8.countTokens() != 2) {
- throw new AWTException("failed to parse hotspot property for cursor: " + var0);
- }
-
- int var9 = 0;
- int var10 = 0;
-
- try {
- var9 = Integer.parseInt(var8.nextToken());
- var10 = Integer.parseInt(var8.nextToken());
- } catch (NumberFormatException var15) {
- throw new AWTException("failed to parse hotspot property for cursor: " + var0);
- }
-
- try {
- var1 = (Cursor)AccessController.doPrivileged(new 1(var5, var9, var10, var6));
- } catch (Exception var14) {
- throw new AWTException("Exception: " + var14.getClass() + " " + ((Throwable)var14).getMessage() + " occurred while creating cursor " + var0);
- }
-
- if (var1 == null) {
- System.err.println("Cursor.getSystemCustomCursor(" + var0 + ") returned null");
- } else {
- systemCustomCursors.put(var0, var1);
- }
- }
-
- return var1;
- }
-
- public static Cursor getDefaultCursor() {
- return getPredefinedCursor(0);
- }
-
- public Cursor(int var1) {
- if (var1 >= 0 && var1 <= 13) {
- this.type = var1;
- this.name = Toolkit.getProperty(cursorProperties[var1][0], cursorProperties[var1][1]);
- } else {
- throw new IllegalArgumentException("illegal cursor type");
- }
- }
-
- protected Cursor(String var1) {
- this.type = -1;
- this.name = var1;
- }
-
- public int getType() {
- return this.type;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String toString() {
- return this.getClass().getName() + "[" + this.getName() + "]";
- }
-
- private static void loadSystemCustomCursorProperties() throws AWTException {
- Hashtable var0 = systemCustomCursors;
- synchronized(var0) {
- systemCustomCursorProperties = new Properties();
-
- try {
- AccessController.doPrivileged(new 2());
- } catch (Exception var3) {
- systemCustomCursorProperties = null;
- throw new AWTException("Exception: " + var3.getClass() + " " + ((Throwable)var3).getMessage() + " occurred while loading: " + systemCustomCursorPropertiesFile);
- }
-
- }
- }
-
- protected native void finalize() throws Throwable;
-
- // $FF: synthetic method
- static String access$000() {
- return systemCustomCursorDirPrefix;
- }
-
- // $FF: synthetic method
- static String access$100() {
- return systemCustomCursorPropertiesFile;
- }
-
- // $FF: synthetic method
- static Properties access$200() {
- return systemCustomCursorProperties;
- }
-
- static {
- systemCustomCursorPropertiesFile = systemCustomCursorDirPrefix + "cursors.properties";
- systemCustomCursorProperties = null;
- Toolkit.loadLibraries();
- initIDs();
- }
- }
-