@Override
	public void actionPerformed(ActionEvent e)
	{
		
		if(e.getSource() == okButton)
		{
			if(!(nameField.getText().equals("")) && !(durationField.getText().equals("")))
			{
				try
				{
					animation = new Animation(nameField.getText(), Integer.parseInt(durationField.getText()));
					this.dispose();
				}
				catch(Exception ex)
				{
					JOptionPane.showMessageDialog(this, "Insert a valid name and duration value.", "Error!", JOptionPane.INFORMATION_MESSAGE);
				}
					
			}
			else
			{
				JOptionPane.showMessageDialog(this, "Insert a valid name and duration value.", "Error!", JOptionPane.INFORMATION_MESSAGE);
			}
		}
		
		if(e.getSource() == cancelButton)
		{
			this.dispose();
		}
		
	}