File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Event handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Event handling" Watch "Event handling" New topic
Author

Event handling

Pat
Greenhorn

Joined: Jan 12, 2002
Posts: 3
Hello,
This is the first time I am posting a query.
The class Test.java is returning error as:
Interface MouseListener of class text not found

Now, I don't understand if the problem is with my code or with my jdk.
Please, help me out.

ps:
Pl use the [ code ] and [ / code ] tags, without the spaces, when posting soruce code. thanks.
- satya
[ January 24, 2002: Message edited by: Madhav Lakkapragada ]
flynn xi
Greenhorn

Joined: Jan 14, 2002
Posts: 8
Hi, buddy, I think you probably should go to check whether you have typed correctly the name of the listener interface.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Maybe you should import java.awt.event.MouseListener interface too !
And be careful, you wrote MouseListner, don;t forget the "e" that comes after the "t" in MouseListener, otherwise it won't compile...
Moreover, we'd like you to read the Javaranch Naming Policy and register again.
Thank you,
HIH
[ January 24, 2002: Message edited by: Valentin Crettaz ]

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
you already got an answer for this ina different forum.
u should import:
import java.awt.event.*;
and the the AWTEvent thingie...
if ull look there ull see the MouseListener interface is defined in the java.awt.event package.
mark stone
Ranch Hand

Joined: Dec 18, 2001
Posts: 417
you need this one import java.awt.event.*;
but you don't need this one setVisible(true);
(required for frames not applets)
Pat
Greenhorn

Joined: Jan 12, 2002
Posts: 3
Thanks Roy,
After having corrected the spelling as well as adding java.awt.event the program still gives the same error.
Could you please compile and tell me if it is compiling at your end.
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
ok. i just tried to run at it at my end and here is what u got to do:
1) change this line :
import java.AWTEvent at the start to this:
import java.awt.event.*;
2) correct the type of the implements MouseListner
to:
implements MouseListener
3) correct the typo
public void mouseRealeased(etc..)
to:
public void mouseReleased(etc...)
4) you have a problem using the add method
inside the mouse Clicked!
the problem is u cant use the add method inside class text. u can only use it in class that u have your Frame. so either use the text class as inner class OR use a constructor to pass the frame refrence to the text class using:
text tt=new text(this);
in the creation.
hope it helps
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Does it really matter a lot? If so, I will register again

There is a standard we would like to keep, so we would be glad if you register again.
Thank you very much for your cooperation
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Thank you for registering but you still don't comply with the policy...
I don't wanna sound picky but I didn't make the rules...
Thank you for your cooperation and we hope you enjoy your time at Javaranch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Event handling