View Single Post
  #2 (permalink)  
Old 08-04-2007, 11:42 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
If you do not explicitly set the actionCommand for a JButton the getActionCommand method will return the button text. This can be a problem when the app is run in a different language. You can avoid this by setting an actionCommand for each button; even if you set the same string as the button text it will be preserved. For your situation you can set different strings for the actionCommand of each button and look for them in the handler.
Code:
JButton buttonOne = new JButton("ADD"); buttonOne.setActionCommand("unique_string");
Reply With Quote