Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4093866

The Cursor Toolkit.createCustomCursor(Image cursor, Point hotSpot, String name)

XMLWordPrintable

    • 1.2.2
    • sparc
    • solaris_2.5.1
    • Verified



      Name: akC57697 Date: 11/18/97



      The method createCustomCursor(..,Point hotSpot,..) does not check
      negative x and y of the hotSpot when creates Cursor under Solaris
      and Windows95.
      The comment for method Toolkit.createCustomCursor() says
      "
      exception IndexOutOfBoundsException if the hotSpot values are
      outside the bounds of the cursor."


      -------------------Example-----------------------------------
      import java.awt.*;
      public class CCursor {
          public static void main(String s[]) {

        Image image = Toolkit.getDefaultToolkit().getImage("smiley.gif");
        Point p =new Point(-1000,-1000);
        
        try {
         Cursor cur=Toolkit.getDefaultToolkit().createCustomCursor(image, p,"Test");
        } catch (IndexOutOfBoundsException e) {
                         System.out.println("OKAY");
                         System.exit(0);
                         }
           catch (Exception e) {
                         System.out.println("Unexpected "+e);
                         System.exit(0);
                         }
          System.out.println("No IndexOutOfBoundsException with Point="+p);
          System.exit(0);
          }
      }

      -------------------Output------------------------------------
      (javator 72): java -fullversion
      java full version "JDK1.2U"
      (javator 73): javac CCursor.java
      (javator 74): java CCursor
      Warning: runtime not compliant with JNI rules: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical
      Run java_g for a Java stacktrace
      Further JNI noncompliance warnings are suppressed
      No IndexOutOfBoundsException with Point=java.awt.Point[x=-1000,y=-1000]

      ======================================================================

            xdengsunw Xianfa Deng (Inactive)
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: