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

The sun.awt.motif.MToolkit.createCustomCursor(,) works wrong with small images

XMLWordPrintable

    • sparc
    • solaris_2.6



      Name: akC57697 Date: 11/23/97



      The sun.awt.motif.MToolkit.createCustomCursor(,,) does not work in accordance
      with spec.


      The comments for Toolkit.getBestCursorSize(int,int) says:
      "
             .........
           * Note: if an image is used whose dimensions don't match a supported size
           * (as returned by this method), the Toolkit implementation will attempt to
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           * resize the image to a supported size.
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           * Since converting low-resolution images is difficult,
           * no guarantees are made as to the quality of a cursor image which isn't a
           * supported size. It is therefore recommended that this method
           * be called and an appropriate image used so no image conversion is made.
           ...........
      "

      -------------------Example-----------------------------------
      import java.awt.*;
      public class CCursorEx {
          public static void main(String s[]) {
          
           Toolkit tk = Toolkit.getDefaultToolkit();
      Image image = tk.getImage("10x13_gif89.gif"); // Very small image
           Cursor cur=tk.createCustomCursor(image,new Point(0,0),"Test");
         }
      }
      -------------------Output------------------------------------
      (novo35 45): javac CCursorEx.java
      (novo35 46): java CCursorEx
      java.lang.ArrayIndexOutOfBoundsException: 16
      at sun.awt.motif.X11CustomCursor.createNativeCursor(X11CustomCursor.java:73)
      at sun.awt.CustomCursor.<init>(CustomCursor.java:84)
      at sun.awt.motif.X11CustomCursor.<init>(X11CustomCursor.java:43)
      at sun.awt.motif.MToolkit.createCustomCursor(MToolkit.java:329)
      at CCursorEx.main(CCursorEx.java:8)
      ^C(novo35 47): java -fullversion
      java full version "JDK-1.2beta2-V"

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

            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: