please include function showImageWithSelections. static void onImageSurfaceHighlightChange(final ImageSurface is, final VF1 f) { final Var highlighted = showImageWithSelections_highlighted; imageSurfaceOnMouseMove(is, new Runnable { Rect last; public void run() { if (eq(highlighted!, last)) ret; last = highlighted!; pcallF(f, last); } }); }