/** Initializes the ImageDisplay. */ private synchronized void initialize() { if (source == null) return; componentWidth = source.getWidth(); componentHeight = source.getHeight(); setPreferredSize(new Dimension(componentWidth, componentHeight)); this.sampleModel = source.getSampleModel(); // First check whether the opimage has already set a suitable ColorModel this.colorModel = source.getColorModel(); if (this.colorModel == null) { // If not, then create one. this.colorModel = PlanarImage.createColorModel(this.sampleModel); if (this.colorModel == null) { throw new IllegalArgumentException("no color model"); } } minTileX = source.getMinTileX(); maxTileX = source.getMinTileX() + source.getNumXTiles() - 1; minTileY = source.getMinTileY(); maxTileY = source.getMinTileY() + source.getNumYTiles() - 1; tileWidth = source.getTileWidth(); tileHeight = source.getTileHeight(); tileGridXOffset = source.getTileGridXOffset(); tileGridYOffset = source.getTileGridYOffset(); }