Original Post
Hi, im new to Java and am trying to create a simple applet that displays the coordinates of the mouse pointer when the button is pressed. The code for it is as follows:
import java.awt.*;
import java.awt.event.*;
import java.awt.event.MouseListener;
public class Main extends javax.swing.JApplet implements MouseListener
{
int xpos,ypos;
public void init()
{
}
public void paint(Graphics screen)
{
screen.drawString("X: "+xpos+" Y: "+ypos,100,100);
}
public void mousePressed(MouseEvent e)
{
xpos = e.getX();
ypos = e.getY();
repaint();
}
public void start()
{
repaint();
}
}
However when i try to compile it I get the following error:
"Main is not abstract and does not override abstract method mouseReleased(java.awt.event.MouseEvent)"
Does anyone know why this is not working. Any advice would be appriecated.