public boolean remove() {
   if (confirm("Cancel measurement? THis will delete all marks.")) {
     interactionHandler.remove();
     this.getParent().remove(this);
     return true;
   }
   return false;
 }
 public void actionPerformed(ActionEvent e) {
   String s = e.getActionCommand();
   if (s == "OK") {
     interactionHandler.analyze();
   } else if (s == "Cancel") {
     remove();
   } else if (s == "Clear") {
     clear();
   }
 }
 private void clear() {
   if (confirm("Really clear marks?")) interactionHandler.clear();
 }