static int letUserMarkScreenArea_shootAfterClickDelay = 1000; static void letUserMarkScreenArea(final O f) { letUserMarkScreenArea(shootScreen2(), f); } // f: voidfunc(Rectangle r, BufferedImage screenshot) - gets called with null values on abort static void letUserMarkScreenArea(final BufferedImage screenshot, final O f) { final JWindow window = showAnimationInTopRightCorner("#1005611", "Please click roughly in the area you would like to select"); trackOneClick(voidfunc(final Point p) { final new Flag done; window.dispose(); thread "Shooting Screen" { sleep(screenshot == null ? letUserMarkScreenArea_shootAfterClickDelay : 0); awt { final BufferedImage screenshot2 = screenshot == null ? shootScreen2() : screenshot; final ImageSurface is = imageSurface(screenshot2); is.setZoom(4); JFrame frame = showCenterFrame("Please select exact area and click OK", jScrollPane(is)); setFrameBounds(frame, centerScreenPart(0.75)); addToWindow(frame, withInset(imageSelectionDepend(is, jbutton("OK", r { Rectangle r = is.selection; if (r != null) { disposeWindow(is); done.raise(); callF(f, r, screenshot2); } })))); is.centerPoint(p); onFrameClose(frame, r { if (!done.isUp()) { done.raise(); callF(f, null, null); } }); } } }); }