How would you do it if the buttons had
labels (text?) and no icons?
or both?
Philip Joshua Gaje
Greenhorn
Joined: Mar 19, 2012
Posts: 2
posted
0
if the button had a label, I often use event.getSource() to access that button. I just don't know what to use if both label and icon are not in the button, and specifically i only used a button with icon but without label.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
what does event.getSource() return?
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4089
posted
0
the link is not working. e.getSource() returns the name of the member variable that caused the event(i'm pretty sure). i like it better with text on my button. i can then say e.getSource().getText(). or better yet i can use e.getActionComand()
SCJP
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
> e.getSource() returns the name of the member variable that caused the event
the question was directed at the OP, to get him to think about what he's doing
i.e. if he can access the button when it has text, why can't he access it with no text
e.getSource().getText() is not the same as e.getActionComand(). Former gets the text of the button and later gets the string used for the command. Both are not necessarily the same.