@Override
	public void actionPerformed(ActionEvent e) {
		
		Object source = e.getSource();
		
		if(source == export) {
			
			int returnVal = fileSaver.showSaveDialog(this);
	        if (returnVal == 0) {
	        	
				File file = fileSaver.getSelectedFile();
				
				try {

					int fYear = -1;
					int fMonth = -1;
					int tYear = -1;
					int tMonth = -1;
					
					if(withDate.isSelected()) {
						
						try {
							fYear = Integer.parseInt(fromYear.getText());
							fMonth = Integer.parseInt(fromMonth.getText());
							tYear = Integer.parseInt(toYear.getText());
							tMonth = Integer.parseInt(toMonth.getText());
						}
						catch(Exception ex) {
							JOptionPane.showMessageDialog(this,
				    			    "Wrong date format!",
				    			    "Error!",
				    			    JOptionPane.ERROR_MESSAGE);
						}
					}
					
					if(file != null) {
						GraphExporter.saveAsGML(file, fYear, fMonth, tYear, tMonth, check.isSelected());
					}
					
					this.dispose();
				}
				catch(Exception ex) {
					JOptionPane.showMessageDialog(this,
		    			    "Couldn't export graph!",
		    			    "Error!",
		    			    JOptionPane.ERROR_MESSAGE);
				}
	        	
	        }
	        
		}
		
		else if(source == withDate) {
			
			if(withDate.isSelected()) {
				fromYear.setEnabled(true);
				fromMonth.setEnabled(true);
				toYear.setEnabled(true);
				toMonth.setEnabled(true);
			}
			else {
				fromYear.setEnabled(false);
				fromMonth.setEnabled(false);
				toYear.setEnabled(false);
				toMonth.setEnabled(false);
			}
			
		}
	}