Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

The type must implement the inherited abstract method???

807601Jan 15 2008 — edited Jan 16 2008
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2008
Added on Jan 15 2008
2 comments
6,310 views