static void addSaveButton(final Component c, final S snippetTitle, O data) { final S string = structureOrText(data); awt { JButton btn = new JButton("Save..."); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { thread { S comment = slte("Comment for upload?"); if (comment != null) { ntUpload("save-" + getProgramID(), snippetTitle, string, comment); print("Saved!"); } } } }); addToWindow(c, btn); } }