addMouseListener(this) will register this as in your current class as a mouse listener and all events for the mouse will be sent to the methods that you had to implement. In these methods you can...
Type: Posts; User: Json
addMouseListener(this) will register this as in your current class as a mouse listener and all events for the mouse will be sent to the methods that you had to implement. In these methods you can...
import java.awt.event.MouseListener;
That should be enough.
// Json
How about you try and implement the MouseListener interface, then your line should be alright there.
public class MovingSquare extends Applet implements MouseListener
// Json