K. Tsang wrote:Forget about the random thing for a sec, how are you doing it right now? In another words, given the 3 buttons how do you determine what icon for which button?
In the action listener, you only have the ActionEvent e, from it you should able to get which button is clicked right? (hint e.getSource())
Oh is your action listener a separate class or part of the GUI class (eg public class MyGUI extends JFrame implements ActionListener)?
Hey, thanks for the fast reply
yes, i do have all of that and running just fine with different images and all.
but in the code i posted i can only specify one. so it will show the same picture for the 3 buttons when clicked.
Does this make any sense?
Let me show you the code.
I created 3 buttons with a background image (all working fine), then when you click another window pops with another image which i invoked with this bit
and with
I call what i want to show. specially the last bit "icon02", but it cant be repeated so it shows the same to all 3 buttons