if (images.get(key) != null) { Image i = (Image)imageCache.get(images.get(key));
Image i = (Image)images.get(key); if (i != null) {
    public Dimension getImageDimensions(Object key) {        if (images.get(key) != null) {            Image i = (Image)imageCache.get(images.get(key));            return new Dimension(i.getWidth(null), i.getHeight(null));        } else {            return new Dimension(0, 0);        }    }