hey everybody,
this is my first post here. So first of all my apologies for any wrongdoings in the netiquette.
Yes, its from school, and its an example from the book, I recreate them to figure out what commands i need and to memorize them. But the problem is, that is doesn't seem to recognize the ButtonHandlers.. According to the book i should need: Import java.awt.event.*; to run events on. That doesn't seem to include those handlers though, what seems to be wrong that the program doesn't recognize them?
package school;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Applet5 extends Applet
{
// declaration
Button button1;
//initialisation
public void init()
{
//button
button1 = new Button( "click Here" );
button1.addActionListener( new ButtonHandler() );
add( button1 );
//background
setBackground ( Color.white );
}
// internal class
class ButtonHandler implements ActionListener
{
public void actionPerformed( ActionEvent e );
{
button1.setLabel("thank you!");
}
} // end internal class
}
--
and this is the debug report that I get:
java.lang.ClassFormatError: school/Applet5$ButtonHandler (Code attribute is absent in method that is not abstract or native)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at school.Applet5.init(Applet5.java:17)
at com.borland.jbuilder.runtime.applet.AppletTestbed.startApplet(Unknown Source)
at com.borland.jbuilder.runtime.applet.AppletTestbed.main(Unknown Source)
Exception in thread "main"
I really can't figure it out..