VolatileImage (@Nullable GraphicsConfiguration cfg, int w, int h) { GraphicsConfiguration safe = cfg != null ? cfg : GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration(); VolatileImage image; try { image = safe.createCompatibleVolatileImage(w, h, new ImageCapabilities(true), Transparency.TRANSLUCENT); } catch (Exception e) { image = safe.createCompatibleVolatileImage(w, h, Transparency.TRANSLUCENT); } // validate first time (it's always RESTORED & cleared) image.validate(cfg); image.setAccelerationPriority(1f); ImageCapabilities caps = image.getCapabilities(); LOG.info(logPrefix(cfg, image) + (caps.isAccelerated() ? "" : "non-") + "accelerated " + (caps.isTrueVolatile() ? "" : "non-") + "volatile " + "image created"); return image; }