static JPanel volatileImageSurfaceDemo() { new Timings timings; JLabel lblTimings = jlabel(); var surface = new JVolatileImageSurface { void renderVolatile(int w, int h, Graphics2D g) { timings.do("background", -> { g.setColor(Color.green); g.fillRect(0, 0, w, h); } timings.do("circle", -> fillCircle(g, w/2, h/2, w/4, Color.blue)); } }; awtDoEvery(lblTimings, 1.0, -> lblTimings.setText(timings.toStringSingleLine())); ret centerAndSouthWithMargin(surface, lblTimings); }