One way is to get the actionCommand String from the actionPerformed's ActionEvent parameter, event, by calling event.getActionCommand(), and then checking if the string equalsIgnoreCase("Button 1")...