Results 1 to 5 of 5
Thread: MyOwnEventExample Erorr!
- 06-16-2009, 02:36 AM #1
-
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.
- 06-16-2009, 02:55 AM #3
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.
-
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:
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.Java Code://S1.addMyOwnEventListener(); //S1.TriggerSomethingEvent(();
By the way, you've already apparently added an event listener correctly in the line above
Why are you trying to also call this method incorrectly?Java Code:S1.addMyOwnEventListener();
Best of luck.Last edited by Fubarable; 06-16-2009 at 03:25 AM.
- 06-16-2009, 09:56 PM #5
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:
And it WORKED thank you very much :DHow 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.
Actually i did that because i think i dont understand well a part of the last question of the homework:By the way, you've already apparently added an event listener correctly in the line above
Why are you trying to also call this method incorrectly?Java Code:S1.addMyOwnEventListener();
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
Similar Threads
-
Interface and implementation erorr
By mihael in forum Advanced JavaReplies: 1Last Post: 12-07-2008, 11:06 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks