Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton question

 
Mike Brown
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic