Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sweetlipsof06

macrumors newbie
Original poster
Nov 29, 2007
3
0
I'm having issues with implementing MouseListener and MouseMotionListener, it continues to say that MyMouseMotionListener must implement the inherited abstract method MouseMotionListener.mouseDragged(MouseEvent), but as you can see in my code below, I have, thus leading to my confusion. Any Ideas?


import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class MouseRectangleAnimation extends JApplet{

int x, y;

public void init(){
addMouseMotionListener(new MyMouseMotionListener());
}

public class MyMouseMotionListener implements MouseMotionListener{

public void mouseMoved(MouseEvent e){
x = e.getX();
y = e.getY();
repaint();
}

public void mouseDragged(MouseEvent e){

}
}
}
 

Sweetlipsof06

macrumors newbie
Original poster
Nov 29, 2007
3
0
Strange

Okay, created a new project and the same code worked fine, same settings and everything, don't know why, but it works so I'm happy.
 

SilentPanda

Moderator emeritus
Oct 8, 2002
9,992
31
The Bamboo Forest
Glad it worked out for you. In the future (in this forum and others) try to use the
Code:
 tag around your code (or similar on other forums) as it makes the code retain its format thus insuring all your beautiful spacing and tabbing gets preserved.  :)

public static void main(String[] args) {
     if (true) {
         System.out.println("hi");
     }
}

[code]public static void main(String[] args) {
     if (true) {
         System.out.println("hi");
     }
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.