private void grabPixels(PixelGrabber grabber) { try { grabber.grabPixels(); } catch (InterruptedException e) { e.printStackTrace(); } // if (grabber.getColorModel() != ColorModel.getRGBdefault()) { // System.err.println("Warning: found other colormodel than default."); // } }
public static void ensureLoaded(Image img) throws Exception { // System.err.println("In ensureloaded"); mediatracker.addImage(img, 0); try { mediatracker.waitForAll(); if (mediatracker.getErrorsAny() != null) { mediatracker.removeImage(img); throw new Exception("Error loading image"); } } catch (InterruptedException e) { e.printStackTrace(); } mediatracker.removeImage(img); // System.err.println("Out ensureloaded"); }