sclass JMaxSpeedAnimation is Swingable { settable IF0 renderFrame; gettable new ImageSurface imageSurface; gettable new DoubleFPSCounter fps; *() {} *(IF0 *renderFrame) {} cachedVisualize { imageSurface.pixelate(true); imageSurface.autoZoomToDisplay(true); awtCalcContinuously(imageSurface, -> { var img = renderFrame!; fps.inc(); displayNewImage(img); }); ret jscroll_center_borderless(imageSurface); } // image may be null (=no update) swappable void displayNewImage(BufferedImage image) { if (image != null) imageSurface.setImage(image); } }