@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
		double amount;
		boolean isLent = false;
		String description;
		String dateString;
		Date date = null;
		SimpleDateFormat dateFormate = new SimpleDateFormat("yyyy-MM-dd");
		
		if(e.getSource() instanceof JButton){
			if(e.getSource()==jbtSave){
				if(jrbBorrow.isSelected()){
					isLent=false;
				}
				else if(jrbLend.isSelected()){
					isLent=true;
				}
				amount = Double.parseDouble(jtfAmount.getText());
				description=jtfDescription.getText();
				dateString = jtfDate.getText();
				try {
					date = dateFormate.parse(dateString);
				} catch (ParseException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				if(date.after(Calendar.getInstance().getTime())){
					String error = "current date is :"+dateFormate.format(Calendar.getInstance().getTime())+". New Transaction cannot be created after this date!";
					JOptionPane.showMessageDialog(null,error,"Error",JOptionPane.ERROR_MESSAGE);	
					setVisible(false);
	                dispose();
	                openUI();
				}
				else{
					//---new transfer created, then how to save it?
					Transfer newTransfer = new Transfer(amount,date,description,isLent);
					Repository.Add(newTransfer);
					Repository.Save();
					if(!SummaryController.GetAlert().equals("")){
						JOptionPane.showMessageDialog(null,SummaryController.GetAlert(),"Alert",JOptionPane.WARNING_MESSAGE);
					}
					setVisible(false);
					dispose();
					WelcomeGUI welcomeGUI = new WelcomeGUI();
					welcomeGUI.openUI();
				}		
			}
			else if(e.getSource()==jbtSelectDate){
				jtfDate.setText(new DatePicker(this).setPickedDate());
			}
			else if(e.getSource()==jbtCancel){
				setVisible(false);
				dispose();
				WelcomeGUI welcomeGUI = new WelcomeGUI();
				welcomeGUI.openUI();
			}
		}
		
		
		
	}