//static int cycleSegmentedComponents2_outline = 4; static void cycleSegmentedComponents2(final BufferedImage img, final BufferedImage bigImg, final L components) { final new Var is; final Var iComponent = new(0); Runnable nextImage = r { is.set(packFrameInTopRightCorner(showZoomedImage(is!, cutOutPixelSet_scale(img, bigImg, components.get(iComponent!)/*, cycleSegmentedComponents2_outline*/), "Cut out " + (iComponent!+1) + "/" + l(components))); iComponent.set(mod(iComponent!+1, l(components)); }; callF(nextImage); packInTopRightCorner(addToWindow(is!, jcenteredbuttons( "Next", nextImage, "Save", r { final JTextField tf = jtextfield(); showTitledForm("Save image", "Name", tf, r { ConnectedComponent c = components.get(iComponent!); S imageID = uploadToLocalImageDB(cutOutPixelSet(img, c), getTextTrim(tf)); infoBox("Image saved as " + imageID); }); }))); }