public void actionPerformed(ActionEvent e) { gui.setText(""); String name = JOptionPane.showInputDialog("Enter Name"); if (name != null) { if (phoneBook.remove(name)) { gui.setText("Success! " + name + " removed."); } else { gui.setText("Failure! " + name + " not found!"); } } else { gui.setText(""); } }