@Override
	public void actionPerformed(ActionEvent arg0) {
		if(arg0.getActionCommand().equals(SAVE_EDIT)){
			System.err.println("Save button pressed.");
			setVisible(false);
//			dirty = true;
			String text = labelField.getText();
			if(!text.equals(bib.getLabel())){
				bib.setLabel(text);
				dirty = true;
			}
//			text = typeField.getText().toLowerCase();
			text = (String) typeChooser.getSelectedItem();
			if(!text.equalsIgnoreCase(bib.getType())){
				bib.setType(text);
				dirty = true;
			}
			for(String key : tfields.keySet()){
				text = tfields.get(key).getText();
				if(!text.equalsIgnoreCase(bib.getField(key))){
					bib.setField(key, text);
					dirty = true;
				}
			}
		}else if(arg0.getActionCommand().equals(CANCEL_EDIT)){
			dirty = false;
			setVisible(false);
		}else if(arg0.getActionCommand().equals(ADD_FIELD)){
			System.err.println("New field is: " + newField.getText() + " with value: " + newValue.getText());
			pane.remove(editPanel);
			if(!labelField.getText().equals("")){
				bib.setLabel(labelField.getText());
			}
//			if(!typeField.getText().equals("")){
//				bib.setType(typeField.getText().toLowerCase());
//			}
			bib.setType((String)typeChooser.getSelectedItem());
			bib.setField(newField.getText(), newValue.getText());
			editPanel = getPanel();
			pane.add(editPanel);
			newField.requestFocus();
			pack();
			repaint();
			dirty = true;
		}
	}