• Post Reply Bookmark Topic Watch Topic
  • New Topic

Triggered actionlistener  RSS feed

 
mike karl
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i find out which button was pressed that triggered an actionlistener. if possible
 
Piet Souris
Rancher
Posts: 1984
67
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way is to give each button a dedicated actionlistener.
Another method would be to use the method e.getSource()
or e.getActionCommand(), where e is the ActionEvent parameter of
the actionPerformed() method.
 
mike karl
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Piet Souris wrote:The easiest way is to give each button a dedicated actionlistener.
Another method would be to use the method e.getSource()
or e.getActionCommand(), where e is the ActionEvent parameter of
the actionPerformed() method.


thank you so much, e.getSource() is what i was looking for, my problem is hard to explain but that is what i needed, thank you
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!