!7 static ImageSurface imageSurface; static JButton btnUpload; static JFrame frame; static JLabel lStatus; concept Title { S title; } p-subst { concepts(); final BufferedImage img = shootScreenHidingConsole(); awt { ImageSurface.verbose = true; imageSurface = new ImageSurface(img) { public void setSelection(Rectangle r) { super.setSelection(r); btnUpload.setText(r != null ? "Upload (selected area)" : "Upload"); lStatus.setText(r == null ? "" : str(new Rect(r))); } }; JPanel buttons = jcenteredline( lStatus = jlabel(), btnUpload = jbutton("Upload", r { String title = or2(uniq(Title).title, "A screenshot"); title = JOptionPane.showInputDialog(null, "Please enter screenshot title", title); if (title == null) return; BufferedImage image = imageSurface.getImage(); if (imageSurface.getSelection() != null) image = new RGBImage(image).clip(imageSurface.getSelection()).getBufferedImage(); cset(uniq(Title), +title); S url = uploadJPEGToImageServer(image, title); popup("Image uploaded: " + url); }), jbutton("Shoot again", r { hideFrame(frame); swingLater(1000, r { imageSurface.setImage(shootScreen2()); makeFrameVisible(imageSurface); maximizeFrame(imageSurface); }); }) ); frame = showMaximizedFrame(centerAndSouth( new JScrollPane(imageSurface), buttons)); if (amFirstProgram()) hideConsole(); } }