src/solaris/classes/sun/awt/X11CustomCursor.java

Print this page
rev 9717 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by:


  30 import java.awt.image.*;
  31 import sun.awt.image.ImageRepresentation;
  32 
  33 /**
  34  * A class to encapsulate a custom image-based cursor.
  35  *
  36  * @see Component#setCursor
  37  * @author      Thomas Ball
  38  */
  39 @SuppressWarnings("serial") // JDK-implementation class
  40 public abstract class X11CustomCursor extends CustomCursor {
  41 
  42     public X11CustomCursor(Image cursor, Point hotSpot, String name)
  43             throws IndexOutOfBoundsException {
  44         super(cursor, hotSpot, name);
  45     }
  46 
  47     protected void createNativeCursor(Image im, int[] pixels, int width, int height,
  48                                       int xHotSpot, int yHotSpot) {
  49 
  50         class CCount implements Comparable {
  51             int color;
  52             int count;
  53 
  54             public CCount(int cl, int ct) {
  55                 color = cl;
  56                 count = ct;
  57             }
  58 
  59             public int compareTo(Object cc) {
  60                 return ((CCount)cc).count - count;
  61             }
  62         }
  63 
  64         int tmp[] = new int[pixels.length];
  65         for (int i=0; i<pixels.length; i++) {
  66             if ((pixels[i] & 0xff000000) == 0) {
  67                 tmp[i] = -1;
  68             } else {
  69                 tmp[i] = pixels[i] & 0x00ffffff;
  70             }
  71         }
  72         java.util.Arrays.sort(tmp);
  73 
  74         int fc = 0x000000;
  75         int bc = 0xffffff;
  76         CCount cols[] = new CCount[pixels.length];
  77 
  78         int is = 0;
  79         int numColors = 0;
  80         while ( is < pixels.length ) {




  30 import java.awt.image.*;
  31 import sun.awt.image.ImageRepresentation;
  32 
  33 /**
  34  * A class to encapsulate a custom image-based cursor.
  35  *
  36  * @see Component#setCursor
  37  * @author      Thomas Ball
  38  */
  39 @SuppressWarnings("serial") // JDK-implementation class
  40 public abstract class X11CustomCursor extends CustomCursor {
  41 
  42     public X11CustomCursor(Image cursor, Point hotSpot, String name)
  43             throws IndexOutOfBoundsException {
  44         super(cursor, hotSpot, name);
  45     }
  46 
  47     protected void createNativeCursor(Image im, int[] pixels, int width, int height,
  48                                       int xHotSpot, int yHotSpot) {
  49 
  50         class CCount implements Comparable<CCount> {
  51             int color;
  52             int count;
  53 
  54             public CCount(int cl, int ct) {
  55                 color = cl;
  56                 count = ct;
  57             }
  58 
  59             public int compareTo(CCount cc) {
  60                 return cc.count - count;
  61             }
  62         }
  63 
  64         int tmp[] = new int[pixels.length];
  65         for (int i=0; i<pixels.length; i++) {
  66             if ((pixels[i] & 0xff000000) == 0) {
  67                 tmp[i] = -1;
  68             } else {
  69                 tmp[i] = pixels[i] & 0x00ffffff;
  70             }
  71         }
  72         java.util.Arrays.sort(tmp);
  73 
  74         int fc = 0x000000;
  75         int bc = 0xffffff;
  76         CCount cols[] = new CCount[pixels.length];
  77 
  78         int is = 0;
  79         int numColors = 0;
  80         while ( is < pixels.length ) {