Presuming 'e' is an ActionEvent from an ActionListener registered with the JButton - use the setActionCommand method of JButton, or compare the source of the event to the Component, or separate out...