@Override
	public void actionPerformed(ActionEvent arg0) 
	{
		Component f = ui;
		while ((f != null) && (!(f instanceof Window)))
			f = f.getParent();
		if (arg0.getActionCommand().equalsIgnoreCase("Cancel"))
		{
			if (f != null)
				f.setVisible(false);
		}
		else if (arg0.getActionCommand().equalsIgnoreCase("Save"))
		{
			if (name.getText().length() == 0)
				JOptionPane.showConfirmDialog(ui, "Name cannot be empty", "ERROR", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
			else if (url.getText().length() == 0)
				JOptionPane.showConfirmDialog(ui, "Image URL cannot be empty", "ERROR", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
			else
			{
				// Fetch the URL to validate
				setName(name.getText());
				setImageURL(url.getText());
				save();
				if (f != null)
					f.setVisible(false);
			}
		}
	}