import java.awt.*;
import java.awt.event.*;
import java.awt.ActiveEvent;
import java.applet.*;
public class MoveIt extends Applet implements ActionListener
{
private Image cup;
private Panel keyPad;
public int yaxis = 15;
public int xaxis = 15;
private Button keysArray[];
public void init()
{
cup = getImage(getDocumentBase(), "cup.gif");
Canvas myCanvas = new Canvas();
setBackground(Color.blue);
setLayout(new BorderLayout());
Button up = new Button("Up");
Button down = new Button("Down");
Button right = new Button("Right");
Button left = new Button("Left");
Button center = new Button("Center");
add(myCanvas, BorderLayout.NORTH);
add(keyPad, BorderLayout.SOUTH);
keyPad.add(up, BorderLayout.NORTH);
up.addActionListener(this);
keyPad.add(down, BorderLayout.SOUTH);
down.addActionListener(this);
keyPad.add(right, BorderLayout.EAST);
right.addActionListener(this);
keyPad.add(left, BorderLayout.WEST);
left.addActionListener(this);
keyPad.add(center, BorderLayout.CENTER);
center.addActionListener(this);
}
public void paint( Graphics g )
{
g.drawImage( cup, xaxis, yaxis, this );
}
public void ActionPerformed(ActionEvent e)
{
String action = e.getActionCommand();
if(action.equals("Up"))
{
yaxis = yaxis - 15;
}
if(action.equals("Down"))
{
yaxis = yaxis + 15;
}
if(action.equals("Left"))
{
xaxis = xaxis - 15;
}
if(action.equals("Right"))
{
xaxis = xaxis + 15;
}
if(action.equals("Center"))
{
xaxis = 125;
yaxis = 60;
}
}
}
How come there is an error:
The type MoveIt must implement the inherited abstract method
ActionListener.actionPerformed(ActionEvent)
What the hell does that mean?