This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I must be the greenest guy in here but since nobody can see me I will go ahead and ask another lame newbie question. Is it possible to use a JButton to cause an event and then use the same button to trigger another event. For instance if I had a picture and I wanted it to get bigger each time I clicked the JButton kind of like a zoom effect. Or If I wanted to use the same JButton to change the background to something different everytime I clicked it. Thanks for your time
Hi Phil, Welcome to JavaRanch! Yes, indeed, what you're describing is easy enough to do. The way to accomplish it is to make the code in an ActionListener dependent on the value of some member variable, and for it to change that variable each time it's called. So you'd want to do something like
[ October 19, 2003: Message edited by: Ernest Friedman-Hill ]