Abstract?

When trying to compile a script that I copied out of a book that I am learning java in, I get this message and can't seem to fix it :(

Revolve.java:7: Revolve is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener

public class Revolve extends JApplet

The script that I have written is below:

import java.applet.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.net.*;

publicclass Revolveextends JApplet

implements Runnable, ActionListener{

String[] pageTitle =new String[6];

URL[] pageLink =new URL[6];

Color butterscotch =new Color(255, 204, 158);

int current = 0;

Thread runner;

publicvoid init(){

pageTitle[0] ="Google";

pageLink[0] = getURL("http://google.com");

pageTitle[1] ="EasyWebbers";

pageLink[1] = getURL("http://easywebbers.com");

pageTitle[2] ="AdTxt";

pageLink[2] = getURL("http://adtxt.net");

pageTitle[3] ="JoshHendo";

pageLink[3] = getURL("http://joshhendo.com");

pageTitle[4] ="Webmasters Meet";

pageLink[4] = getURL("http://webmasters-meet.com");

pageTitle[5] ="NamePros";

pageLink[5] = getURL("http://namepros.com");

Button goButton =new Button("Go");

goButton.addActionListener(this);

FlowLayout flow =new FlowLayout();

setLayout(flow);

add(goButton);

}

URL getURL(String urlText){

URL pageURL =null;

try{

pageURL =new URL(getDocumentBase(), urlText);

}catch (MalformedURLException m){}

return pageURL;

}

publicvoid paing(Graphics screen){

Graphics2D screen2D = (Graphics2D) screen;

screen2D.setColor(butterscotch);

screen2D.fillRect(0, 0, getSize().width, getSize().height);

screen2D.setColor(Color.black);

screen2D.drawString(pageTitle[current], 5, 60);

screen2D.drawString("" + pageLink[current], 5, 80);

}

publicvoid start(){

if (runner ==null){

runner =new Thread(this);

runner.start();

}

}

publicvoid run(){

Thread thisThread = Thread.currentThread();

while (runner == thisThread){

current++;

if (current > 5){

current = 0;

}

repaint();

try{

Thread.sleep(10000);

}catch (InterruptedException e){

//do nothing

}

}

}

publicvoid stop(){

if (runner !=null){

runner =null;

}

}

publicvoid actionPreformed(ActionEvent evt){

if (runner !=null){

runner =null;

}

AppletContext browser = getAppletContext();

if (pageLink[current] !=null){

browser.showDocument(pageLink[current]);

}

}

}

When I copy and paste the same script off their website, it doesn't come up this error. This is the second time this has happend, and I can't see what is wrong with it (the only difference besids that I use tabs and the one on the site uses spaces, is the websites that are rotated :P). The script on the books site can be found here:

http://www.cadenhead.org/book/java-24-hours/source/chapter19/Revolve.java

Thanks :)

[6252 byte] By [JoshHendoa] at [2007-10-2 10:56:34]
# 1

To improve communications, please use the term "code" instead of "script" because that's what nearly everyone calls Java code.

Look at the error message - it says "..does not override abstract method actionPerformed..."

Now, look in your code for the actionPerformed method. Pay very close attention to spelling.

atmguya at 2007-7-13 3:21:46 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

I tried out the code you had mentioned, the program is working perfectly for me..

Please check for any typing errors. The code you had given is working properly.

If you have the eclipse editor(its a java editor), try putting the program in it, you will come to know of any possible errors,if present.

Do recheck the program you have typed. The program works properly,when i executed

venkateshpa at 2007-7-13 3:21:46 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

> I tried out the code you had mentioned, the program

> is working perfectly for me..

> Please check for any typing errors. The code you had

> given is working properly.

> If you have the eclipse editor(its a java editor),

> try putting the program in it, you will come to know

> of any possible errors,if present.

> Do recheck the program you have typed. The program

> works properly,when i executed

Do you mean your compiler understood that "actionPreformed" was the ActionListener method actionPerfomed? Mine sure doesn't.

atmguya at 2007-7-13 3:21:46 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...