• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

eventhandling

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I'm new to java. Can anyone help me?
on compiling the undergiven code I use to get this error:
"Class ActionEvent not found in void processActionEvent(ActionEvent)
"

import java.awt.AWTEvent;
import java.util.EventObject;
import java.applet.Applet;
import java.awt.*;
public class child extends Applet{
ChildButton b = new ChildButton("TOUCH ME NOT");
}
class ChildButton extends Button{
ChildButton(String chez){
super(chez);
enableEvents(AWTEvent.ACTION_EVENT_MASK);
}
public void processActionEvent(ActionEvent e){
System.out.println("OUUUCH YOU SCOUNKDRELLLLL!!!");
super.processActionEvent(e);
}
}
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you forgot to import the package
java.awt.event.*;
it compiles fine when included...
Have fun,
Kavitha
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,the answer is
just put the function in the applet class
and also put the package
you willbe able to see a button
import java.awt.*;
public void init()
{
add(b);
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic