void (Graphics2D g) { if (!myComponent.isShowing()) { return; } myFpsMeter.paintFrameStarted(); VolatileImage vi = myVolatileImage; do { boolean contentOutdated = myContentOutdated; myContentOutdated = false; if (vi == null || vi.getWidth() != myComponent.getWidth() || vi.getHeight() != myComponent.getHeight()) { vi = createVolatileImage(); } else if (contentOutdated) { drawVolatileImage(vi); } switch (vi.validate(myComponent.getGraphicsConfiguration())) { case VolatileImage.IMAGE_RESTORED -> drawVolatileImage(vi); case VolatileImage.IMAGE_INCOMPATIBLE -> vi = createVolatileImage(); } g.drawImage(vi, 0, 0, null); } while (vi.contentsLost()); myVolatileImage = vi; myFpsMeter.paintFrameFinished(g); }