image = new BufferedImage(icm, bi.getRaster(), false, null);
setImage(new BufferedImage(icm, bi.getRaster(), false, null));
    public void setTransparentPixel(int trans)  {        BufferedImage bi = this.getBufferedImage();        ColorModel cm = bi.getColorModel();        if (!(cm instanceof IndexColorModel))            throw new RuntimeException("Image is not indexed!");        IndexColorModel icm = (IndexColorModel) cm;        int mapSize = icm.getMapSize();        byte reds[] = new byte[mapSize];        byte greens[] = new byte[mapSize];        byte blues[] = new byte[mapSize];        icm.getReds(reds);        icm.getGreens(greens);        icm.getBlues(blues);        // create the new IndexColorModel with the changed transparentPixel:        icm = new IndexColorModel(icm.getPixelSize(), mapSize, reds, greens,            blues, trans);        // create a new BufferedImage with the new IndexColorModel and the old        // raster:        image = new BufferedImage(icm, bi.getRaster(), false, null);    }