private void onDoneClick() throws IOException {
   for (ImageMarker marker : cornerAndControlMarkers) {
     if (marker.getID() == null) {
       JOptionPane.showMessageDialog(
           this, "You can't be done until you've " + "labeled every corner and control point!");
       return;
     }
   }
   int choice;
   choice =
       JOptionPane.showConfirmDialog(
           null, "Would you like to do another picture??", "Message", JOptionPane.YES_NO_OPTION);
   if (choice == 0) { // YES
     outputHelper();
     cornerAXText.setText("");
     cornerAYText.setText("");
     cornerBXText.setText("");
     cornerBYText.setText("");
     cornerCXText.setText("");
     cornerCYText.setText("");
     cornerDXText.setText("");
     cornerDYText.setText("");
     sideLengthText.setText("8");
     hfovText.setText("");
     JPEGText.setText("");
     framePoints.setVisible(true);
     framePoints.dispose();
   } else if (choice == 1) { // NO
     outputHelper();
     framePoints.setVisible(false);
     framePoints.dispose();
     this.setVisible(false);
     this.dispose();
   }
 }
  private void outputHelper() throws IOException {
    miscInfo = new PrintWriter(new FileWriter(JPEGFileName.replace(".JPG", "_miscInfo.txt")));
    outline = new PrintWriter(new FileWriter(JPEGFileName.replace(".JPG", "_outline.txt")));
    controlPoints =
        new PrintWriter(new FileWriter(JPEGFileName.replace(".JPG", "_controlpoints.txt")));
    squareCorners = new PrintWriter(new FileWriter(JPEGFileName.replace(".JPG", "_corners.txt")));

    miscInfo.println("JPG Filename: " + JPEGFileName);

    miscInfo.println(
        "Image Height, Width: " + pointsImage.getHeight() + ", " + pointsImage.getWidth());
    miscInfo.println("CornerA (X,Y): " + cornerAXText.getText() + ", " + cornerAYText.getText());
    miscInfo.println("CornerB (X,Y): " + cornerBXText.getText() + ", " + cornerBYText.getText());
    miscInfo.println("CornerC (X,Y): " + cornerCXText.getText() + ", " + cornerCYText.getText());
    miscInfo.println("CornerD (X,Y): " + cornerDXText.getText() + ", " + cornerDYText.getText());

    miscInfo.println("Square Side Length: " + sideLengthText.getText());
    miscInfo.println("HFOV: " + hfovText.getText());

    // Output the four corner coordinates.
    squareCorners.println(cornerAXText.getText() + "," + cornerAYText.getText());
    squareCorners.println(cornerBXText.getText() + "," + cornerBYText.getText());
    squareCorners.println(cornerCXText.getText() + "," + cornerCYText.getText());
    squareCorners.println(cornerDXText.getText() + "," + cornerDYText.getText());

    // Output the control point IDs and coordinates
    for (ImageMarker marker : cornerAndControlMarkers) {
      if (marker.getType() == ImageMarker.MarkerType.CONTROL_POINT) {
        controlPoints.println(
            marker.getID()
                + ","
                + (marker.getLocation().x + 0.5)
                + ","
                + (marker.getLocation().y + 0.5));
      }
    }

    // Output the stream outline data
    for (ImageMarker marker : outlineMarkers) {
      if (marker.getType() == ImageMarker.MarkerType.OUTLINE_POINT) {
        outline.println((marker.getLocation().x + 0.5) + "," + (marker.getLocation().y + 0.5));
      }
    }
    miscInfo.close();
    controlPoints.close();
    squareCorners.close();
    outline.close();
  }