This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes event generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "event generation" Watch "event generation" New topic

event generation

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
hi all,
can we progammatically invoke the event of a button ?? i mean, without implementing the ActionListner interface is it possible to invoke the event of a button using jdk1.2 or higher ??

SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can use this from api:
fireActionPerformed protected void fireActionPerformed(ActionEvent event)

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

but you need to implement your listener !!!
[ June 30, 2003: Message edited by: Benjamin Leonard ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Another option might be to move the ActionPerformed task into a separate function. The function is then able to be called from elsewhere in the code.
instead of this

something like this
I agree. Here's the link:
subject: event generation
Similar Threads
How to call a javascript function on back button press of the brower window
How to identify when refresh button of browser or f5 is pressed
Two submit buttons in a form?
validating textfield with +ve/-ve values using 2 radiobuttons
Firing a Java Code on a scheduled time