@Override
	public void actionPerformed(ActionEvent arg0) {
		// Determine the event source
		if (arg0.getSource() == btnSet) {
			// Update the grid and axes
			setGrid(xAxisSel.getSelectedIndex(), yAxisSel.getSelectedIndex());
		} else if (arg0.getSource() == btnSearch || arg0.getSource() == chkVis) {
			// Generate a new book set based on the user query
			searchMatch.clear();
			if (!(txtSearch.getText().trim().length() == 0)) {
				searchMatch = repository.getBookData().find(txtSearch.getText());
			}
			if(chkVis.isSelected()){
				xAxisSel.setEnabled(true);
			}else{
				xAxisSel.setEnabled(false);
			}
			// update the grid
			setGrid(xAxisSel.getSelectedIndex(), yAxisSel.getSelectedIndex());
		} else if (arg0.getSource() == btnClear) {
			// clears any user selections
			for (int i = 0; i < gridPanel.getComponents().length; i++) {
				// find each gridCell within gridPanel
				if (gridPanel.getComponent(i) instanceof GridCell) {
					GridCell temp = (GridCell) gridPanel.getComponent(i);
					boolean change = temp.clear();
					if(change){
					gridPanel.add(temp,i);
					}
//					// if temp had selections when cleared, replace it into the
//					// grid panel
//					if (change) {
//						gridPanel.remove(i);
//						gridPanel.add(temp, i);
//					}
				}
			}
		} else if (arg0.getSource() == btnCompare) {
			ArrayList<BookNode> selection = getSelectedNodes();
			//Build the ArrayList of Books
			ArrayList<Book> selectedBooks = new ArrayList<Book>();
			for(int i = 0;i < selection.size();i++){
				Book cur = repository.bookTitleQuery(selection.get(i).getTitle());
				if(cur != null){
					selectedBooks.add(cur);
				}
			}
			if(selectedBooks.size() != 0){
				Interface i = new Interface(selectedBooks, this);
			}
		}
		gridPanel.revalidate();
		gridPanel.repaint();
	}