Results 1 to 5 of 5
  1. #1
    Laythe's Avatar
    Laythe is offline Member
    Join Date
    Mar 2009
    Posts
    28
    Rep Power
    0

    Default MyOwnEventExample Erorr!

    Hello EveryOne :)

    would anyone tell me what is wrong with this code Please.
    Attached Files Attached Files

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    What problems are you having? Any error messages at compile time? Any exceptions at runtime? If you have any error messages, please post them here.

  3. #3
    Laythe's Avatar
    Laythe is offline Member
    Join Date
    Mar 2009
    Posts
    28
    Rep Power
    0

    Default

    i have an error message at compile time this is the two lines where i get the error:

    S1.addMyOwnEventListener();
    S1.TriggerSomethingEvent();

    Error:

    * addMyOwnEventListener(MyOwnEventListenerInterface) in MyOwnEventSource
    cannot be applied to ().

    * TriggerSomethingEvent(java.util.Date) in MyOwnEventSource cannot be
    applied to ().

    - I know i can't use a String as parameter of the TriggerSomethingEvent() Method becouse the event is supported from java.util.Date not supported from java.util.String.

    if you need any more details just take a looke at the Attached zip.

    so what should i do??
    Last edited by Laythe; 06-16-2009 at 03:12 AM.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    The error messages seem to be self-explanatory here: you're trying to call methods but don't seem to be passing them the required parameters. How about passing the parameters that are specified in the method signature: MyOwnEventListenerInterface implementing object for the first method, and a Date object for the second.

    If this doesn't help, then you'll need to provide more context here, probably a lot more context.

    edit:
    to clarify, the reason I'm asking for context is because I can simply solve your compile problem by doing this:
    Java Code:
            //S1.addMyOwnEventListener();
            //S1.TriggerSomethingEvent(();
    But I doubt that this solves your overall problem. Unfortunately before we can help solve that, we have to have an inkling of just what you're trying to do.

    By the way, you've already apparently added an event listener correctly in the line above
    Java Code:
    S1.addMyOwnEventListener();
    Why are you trying to also call this method incorrectly?

    Best of luck.
    Last edited by Fubarable; 06-16-2009 at 03:25 AM.

  5. #5
    Laythe's Avatar
    Laythe is offline Member
    Join Date
    Mar 2009
    Posts
    28
    Rep Power
    0

    Default

    Hello.

    this is what they asked me on the HomeWork i am doing:

    The homework exercise is to create MyOwnEventExample project by editing MyFirstEventExample project as following:

    1) The new event is called MyOwnEvent.
    2) Write MyOwnEvent.java. This class has the following method
    --> getCurrentTime() - use java.util.Date() method to return current date and time
    3) Write MyOwnEventListenerInterface.java.
    4) Write MyOwnListenerImpl.java.
    --> When event is fired, display the date and time of the event
    5) Write MyOwnEventSource.java
    6) Write MyOwnEventExample.java in which event registration and event triggering is performed.

    I did as you said:

    How about passing the parameters that are specified in the method signature: MyOwnEventListenerInterface implementing object for the first method, and a Date object for the second.
    And it WORKED thank you very much :D

    By the way, you've already apparently added an event listener correctly in the line above
    Java Code:
    S1.addMyOwnEventListener();
    Why are you trying to also call this method incorrectly?
    Actually i did that because i think i dont understand well a part of the last question of the homework:
    6) Write MyOwnEventExample.java in which event registration is performed.

    would you tell me what the event registration is?

    Thank you Sir Fubarable for you help, I Really Appreciate it :D
    Attached Files Attached Files

Similar Threads

  1. Interface and implementation erorr
    By mihael in forum Advanced Java
    Replies: 1
    Last Post: 12-07-2008, 11:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •