Ok so I am still just learning JAVA programming, but I do have some experience with programs. I am attempting to write an Applet that has a rectangle or something follow the mouse around. I have not actually gotten a whole lot written yet, just like 20 lines or so.
What i am having problems with (this is probably really simple...) is getting the mousemotionlistener to work. This is the code i have so far. I will underline where the errors are.
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import javax.swing.JApplet;
import javax.swing.JFrame;
public class moveTest extends JApplet implements MouseMotionListener
{
public static void main(String[] args)
{
JFrame mover = new JFrame();
mover.addMouseMotionListener(f);
mover.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
mover.setSize(400,400);
mover.setLocation(200,200);
mover.setVisible(true);
}
public void mouseDragged(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public void mouseMoved(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
how do i fix this error? I am sure i need to put something in place of f. i just dont know what