Jump to content

  • Log In with Google      Sign In   
  • Create Account


[java] Events


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 koatto   Members   -  Reputation: 122

Like
Likes
Like

Posted 04 January 2001 - 01:06 PM

Events can be fired by any object or only gui components can generate them? Can i make an object trigger a custom event?

Sponsor:

#2 c_wraith   Members   -  Reputation: 122

Like
Likes
Like

Posted 04 January 2001 - 04:14 PM

Any object can deliver events, through the dispatchEvent(AWTEvent e) method in the Component class. Simply call that method with an appropriate event, on the GUI component you would like to have receive the event.

As far as custom events go, it''s possible, through careful study of the AWTEvent class and the EventListener interface... I haven''t done it though, so all I can tell you is that it''s possible.

#3 Neurotic   Members   -  Reputation: 122

Like
Likes
Like

Posted 05 January 2001 - 01:19 PM

"Events can be fired by any object"

In reality this is the case, as event methods, such as
actionPerformed(actionEvent event) are public methods.

So there is nothing to stop you creating your own actionEvent (or mouseEvent, or windowEvent or whatever) and passing it into that method to trigger your own "custom" event.

Now, one could discuss whether or not this is good coding practice.. but it can be useful to get you out of a pinch

Mark



----
www.emanatemultimedia.com
----

#4 koatto   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 January 2001 - 12:21 AM

What the EventListener interface really do?
The api docs are very short of infos about...



#5 buh   Members   -  Reputation: 122

Like
Likes
Like

Posted 06 January 2001 - 04:31 PM

EventListener does nothing. It''s a tagging interface like Serializable and Remote.

buh!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS