public void setImageRepaint ( BufferedImage image ) { // if image is larger before than the new image then you need to make sure you repaint // the entire image otherwise a ghost will be left ScaleOffset workspace ; if ( SwingUtilities . isEventDispatchThread ( ) ) { workspace = adjustmentGUI ; } else { workspace = new ScaleOffset ( ) ; } repaintJustImage ( img , workspace ) ; this . img = image ; if ( image != null ) { repaintJustImage ( img , workspace ) ; } else { repaint ( ) ; } }
Changes the buffered image and calls repaint . Does not need to be called in the UI thread .