Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

action events 1

Status
Not open for further replies.

mactonio

Programmer
Nov 18, 2003
55
US
Hi guys,
I have a GUI with some buttons and combo boxes, they are all tied to an action listener and thats working fine, what i want to know is, is there a function that I can use to trigger an action, for eg. a function call that makes the program thinks a button was pressed, even though it wasnt

thanks
Chris
 
You want to programmatically click the button or to make the program act like if the button was pressed?

Cheers,
Dian
 
whichever one would be fine I guess, I just want to trigger the action listener.

thanks for the fast reply
 
Normally when a button event is captured, you call a method - why can you not just call that method based on your parameters for wanting to call that method ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
... otherwise (and if using the Robot is too much trouble), you could always build the ActionEvent yourself and post it to the EventQueue. Take a look at java.awt.EventQueue, java.awt.AWTEvent and java.awt.event.ActionEvent.

But unless you've got some requirement for this that you're not telling us, sedj's suggestion would seem the best course.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
To make the button clicked, a call to its click() method would be enough ...

Cheers,
Dian
 
thanks for all your ideas......Dian that is what i was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top