image = ((BufferedImage)image).getSubimage(x, y, w, h);
setImage(((BufferedImage)image).getSubimage(x, y, w, h));
    public void crop(int x, int y, int w, int h) {        // do not use the CropFilter any longer:        if (image instanceof BufferedImage) {            // BufferedImages define their own function for cropping:            image = ((BufferedImage)image).getSubimage(x, y, w, h);        } else {            // The internal image will be a BufferedImage after this.            // Simply create it with the cropped dimensions and draw the image into it:            BufferedImage buffered = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);            Graphics2D g2d = buffered.createGraphics();            g2d.drawImage(image, -x, -y, null);            g2d.dispose();            image = buffered;        }    }