• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to press JButtons from within the program?  RSS feed

 
Michelle Kyamo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My applet will have multiple buttons. When some of the buttons (B,C,&D) are pressed by the user, I would like the code that is executed then to include automatically pressing another button (button A). I wish that JButton had a method pressButton() that I could call from within the program. Of course I could just copy and paste all the code that happens when button A is pressed into buttons B C and D, but I was wondering if there is a less messy way to do this.
 
Rob Camick
Ranch Hand
Posts: 2788
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish that JButton had a method pressButton() that I could call from within the program


 
Michelle Kyamo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:
I wish that JButton had a method pressButton() that I could call from within the program




Oh thank you so much, I guess I missed that when I was scanning the methods to see if there was one that might press it!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!