/** * Handles the <tt>ActionEvent</tt> which occurred when user clicks the Search button. * * @param e the <tt>ActionEvent</tt> that notified us of the button click */ public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); String buttonName = button.getName(); if (buttonName.equalsIgnoreCase("search")) { historyWindow.showHistoryByKeyword(searchTextField.getText()); } }
/** * When all text is removed from the search field shows the whole history. * * @param e the <tt>DocumentEvent</tt> that notified us of the text remove */ public void removeUpdate(DocumentEvent e) { if (searchTextField.getText() == null || searchTextField.getText().equals("")) { historyWindow.showHistoryByKeyword(""); } }