Patch: Cursor fixlet
Tom Tromey
tromey@redhat.com
Thu Jan 11 09:49:00 GMT 2001
I'm checking in this fixlet.
2001-01-11 Tom Tromey <tromey@redhat.com>
* java/awt/Cursor.java (Cursor(String)): Set type to custom.
(Cursor(int), getPredefinedCursor): Throw exception if argument
invalid.
Tom
Index: java/awt/Cursor.java
===================================================================
RCS file: /cvs/gcc/egcs/libjava/java/awt/Cursor.java,v
retrieving revision 1.2
diff -u -r1.2 Cursor.java
--- Cursor.java 2000/12/26 00:25:12 1.2
+++ Cursor.java 2001/01/11 17:48:18
@@ -36,6 +36,8 @@
public Cursor(int type)
{
+ if (type < 0 || type >= PREDEFINED_COUNT)
+ throw new IllegalArgumentException ("invalid cursor " + type);
this.type = type;
// FIXME: lookup and set name?
}
@@ -46,13 +48,13 @@
protected Cursor(String name)
{
this.name = name;
- // FIXME
+ this.type = CUSTOM_CURSOR;
}
public static Cursor getPredefinedCursor(int type)
{
- if (type >= PREDEFINED_COUNT)
- return null;
+ if (type < 0 || type >= PREDEFINED_COUNT)
+ throw new IllegalArgumentException ("invalid cursor " + type);
if (predefined[type] == null)
predefined[type] = new Cursor(type);
return predefined[type];
More information about the Java-patches
mailing list