if (getImage() == null) { return null; }
    public Point getCentroid ()    {        if (centroid == null) {            BufferedImage bi = IconManager.toBufferedImage(getImage());            final int width  = getDimension().width;            final int height = getDimension().height;            int[] argbs = new int[width * height];            bi.getRGB(0,0,width,height,argbs,0,width);            int sw = 0;           // Total weight of non transparent points            int sx = 0;           // x moment            int sy = 0;           // y moment            for (int y = 0; y < height; y++) {                for (int x = 0; x < width; x++) {                    int argb = argbs[x + y*width];                    int a = (argb & 0xff000000) >>> 24; // Alpha                    if (a != 0) {                        int b = (argb & 0x000000ff);    // Blue                        int w = 255 - b;                // Darker = heavier                        sw += w;                        sx += x * w;                        sy += y * w;                    }                }            }            centroid = new Point((int) Math.rint((double) sx/sw),                                 (int) Math.rint((double) sy/sw));        }        return centroid;    }