@Override
	public void actionPerformed(ActionEvent e) {
		// All that long code down there? It's all to save the image.
		if (e.getSource() == save) {
			JFileChooser saver = new JFileChooser() {
				// Override modified based off of version on thepcwizard.com
				// This handles overwriting existing files
				@Override
				public void approveSelection() {
					String[] options = new String[] { "Replace", "Cancel" };

					File f;
					if (!getFileFilter().accept(getSelectedFile())) {
						f = new File(getSelectedFile().getAbsolutePath()
								+ ".png");
					} else {
						f = getSelectedFile();
					}
					if (f.exists()) {
						int result = JOptionPane
								.showOptionDialog(
										this,
										"File already exists. Replace the existing file?",
										"File already exists",
										JOptionPane.OK_CANCEL_OPTION,
										JOptionPane.WARNING_MESSAGE, null,
										options, options[1]);
						switch (result) {
						case JOptionPane.NO_OPTION:
							return;
						case JOptionPane.OK_OPTION:
							super.approveSelection();
							return;
						case JOptionPane.CLOSED_OPTION:
							return;

						}
					}
					super.approveSelection();
				}
			};

			saver.setAcceptAllFileFilterUsed(false);
			saver.setFileFilter(new PictureFilter());
			int result = saver.showSaveDialog(this);
			if (result == JFileChooser.APPROVE_OPTION) {
				File file = saver.getSelectedFile();
				if (!saver.getFileFilter().accept(file)) {
					file = new File(file.getAbsolutePath() + ".png");
				}

				try {
					ImageIO.write(parent.img, "png", file);
					JOptionPane.showMessageDialog(null, "Image saved", "Saved",
							JOptionPane.INFORMATION_MESSAGE);
				} catch (IOException ex) {
					JOptionPane.showMessageDialog(null,
							"Error. Something went wrong while saving.",
							"Error", JOptionPane.ERROR_MESSAGE);
				}
			}
		}
	}