static JComponent jMaxSpeedAnimationWithStats(IF0> renderFrameWithStats) { new ImageSurface is; is.pixelate(true); //is.autoZoomToDisplay(true); new DoubleFPSCounter fps; var lblStats = jlabel(); awtCalcContinuously(is, -> { try { var imageAndStats = renderFrameWithStats!; var image = pairA(imageAndStats); if (image != null) { fps.inc(); is.setImage(image); setText(lblStats, joinNemptiesWithComma(fps, pairB(imageAndStats))); } else sleep(10); } catch print e { setText(lblStats, exceptionToStringShort(e)); sleepSeconds(1); // error penalty } }); ret centerAndSouth(jscroll_center_borderless(is), withMargin(lblStats)); }