// f: (int w, int h) -> BufferedImage static ImageSurface jcanvas(O f) { ret jcanvas(f, 500); } static ImageSurface jcanvas(O f, final int updateDelay) { assertAWTThread(); final new ImageSurface is; onResize(is, r { awtLater(is, updateDelay, r { BufferedImage img = is.getImage(); int w = is.getWidth(), h = is.getHeight(); if (img.getWidth() != w || img.getHeight() != h) is.setImage(asBufferedImage(callF(f, w, h))); }); }); ret is; }