event handling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stmfc
    New Member
    • May 2007
    • 65

    #1

    event handling

    hi,
    for an event handling mechanism,
    we need an event object. (the object where the event actually occur)
    and we need an event handler,
    and we need a registration of the event handler to the event object(generato r)

    in java, we can create a generator class by extending EventObject class.
    we can create an event handler class by implementing EventListener interface.

    for registration we can provide some registration method (e.g addMyListener )
    in our generator class.

    my 1st question: can this registration method be like any other method, or is there any restriction on it, or does it have any special behaviour?

    my 2nd question: did i figure out event handling issue correctly, or is there any missing/incorrect points?

    thanks in advance...
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by stmfc
    hi,
    for an event handling mechanism,
    we need an event object. (the object where the event actually occur)
    and we need an event handler,
    and we need a registration of the event handler to the event object(generato r)

    in java, we can create a generator class by extending EventObject class.
    we can create an event handler class by implementing EventListener interface.

    for registration we can provide some registration method (e.g addMyListener )
    in our generator class.

    my 1st question: can this registration method be like any other method, or is there any restriction on it, or does it have any special behaviour?

    my 2nd question: did i figure out event handling issue correctly, or is there any missing/incorrect points?

    thanks in advance...
    I think you've just about got it.
    The addMyListener method must generally accept an EventListener argument.

    Comment

    Working...