@Override
	public void actionPerformed(ActionEvent arg0) {
		JFileChooser jfc = new JFileChooser();
		
		int selection = jfc.showSaveDialog(TrendFrame.frame);
		
		if(selection == JFileChooser.APPROVE_OPTION){
			// Save the file
			File f = jfc.getSelectedFile();
			FileWriter fw;
			try {
				fw = new FileWriter(f);
			} catch (IOException e) {
				fw = null;
				e.printStackTrace();
			}
			BufferedWriter writer = new BufferedWriter(fw);
			
			int increment = 100/(CrimeWatch.details.size()+1);
			for(Long key : CrimeWatch.details.keySet()){
				try {
					writer.write(CrimeWatch.details.get(key));
					TrendFrame.progress.setValue(TrendFrame.progress.getValue()+(increment/2));
				} catch (IOException e) {
					JOptionPane.showMessageDialog(TrendFrame.frame,
						    "There was an error writing the file.",
						    "An Error Occurred",
						    JOptionPane.ERROR_MESSAGE);
					e.printStackTrace();
					break;
				}
				try {
					writer.newLine();
					TrendFrame.progress.setValue(TrendFrame.progress.getValue()+(increment/2));
				} catch (IOException e) {
					JOptionPane.showMessageDialog(TrendFrame.frame,
						    "There was an error writing the file.",
						    "An Error Occurred",
						    JOptionPane.ERROR_MESSAGE);
					e.printStackTrace();
					break;
				}
			}
			
			try {
				writer.flush();
			} catch (IOException e) {
				JOptionPane.showMessageDialog(TrendFrame.frame,
					    "There was an error saving the file.",
					    "An Error Occurred",
					    JOptionPane.ERROR_MESSAGE);
				e.printStackTrace();
			}
			try {
				writer.close();
			} catch (IOException e) {
					JOptionPane.showMessageDialog(TrendFrame.frame,
						    "There was an error saving the file.",
						    "An Error Occurred",
						    JOptionPane.ERROR_MESSAGE);
					e.printStackTrace();
				
			}
			
			JOptionPane.showMessageDialog(TrendFrame.frame,
				    "Markers file saved successfully.",
				    "Information",
				    JOptionPane.INFORMATION_MESSAGE);
			
		}
	}