implementing Mouse Listener
Hi coders
I am was a .Net coder I wanna learn java. I have a little problem. I use NetBeans 5.0 and I wanna implement MouseListener and MoseMoutionListener to my Public clas which I had created by selecting JFrame classType. So outomatically NetBens did like this
"public class gorunum extends javax.swing.JFrame" and when I add this
"public class gorunum extends javax.swing.JFrame implements MouseListener {"
NetBeans make under line (red) my code.
error message is : "windowclass.gorunum is not abstract and does not override abstract method mouseExited(java.awt.event.MouseEvent) in java.awt.event.MouseListener"
But when I did it while I was working with ordinary class which I added it by selecting JavaClass from Netbeans.. like this :
"public class gorunum extends JFrame implements MouseListener {"
there is no problem.
Why it is a problem when I did it in a JFrame class and it is not a problem when I did it in a ordinary clas? How can I do it in JFrame class
Thanks..
[1048 byte] By [
cutEmrea] at [2007-10-2 21:17:35]

Hi,
you already extend one class, so extending the lazy coders darling MouseAdapter is not possible. If you really need that class to be a MouseListener, you have to implement all five Methods listed in the MouseListener Interface, according to Java-docs:
public void mouseClicked(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
HTH,
mamue
I have to implement mouseListener but I can't it due to error message which I had wrote it my old message. I have to implement couse, ?wanna add this code in my class
btn.addMouseListener( this ); if I use my class for mouseListener I have to implement it.
I do not know what is the problem
Well, it is exactly as I said, you have to implement all of those methods listed in the interface MouseListener and the compiler is telling you that you did not:
windowclass.gorunum is not abstract and does not override abstract method mouseExited(java.awt.event.MouseEvent) in java.awt.event.MouseListener"
Does your class implement the method "public void mouseExited( MouseEvent e )"? The compiler tells you that you havn't.
HTH,
mamue
Thank u Man,I have been writing in visual Studio since 1998, and I used easly IDE, but I am new in Java, it was surprised to see this error cuse of that functions, NetBeans has to be usefull than this position.Thank U again. it is ok ;)