• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

USING ACTIONLISTENER IN APPLET

Hi
How can we use the interface ActionLisener in an Applet.Currently I have used it in the following way.
public class xyz extends java.applet.Applet{
public void init()
{
Button b =new Button ("CUT");
b.addActionListener(new PDL());
add(b);
}
public class PDL implements ActionListener{...
...
}
}
But the compiler is giving the error that PDL is an abstract class and hence it can't be instantiated and that the method java.awt.event.ActionListener not found.
0
sun307
Asked:
sun307
1 Solution
 
sun307Author Commented:
Edited text of question.
0
 
samersCommented:
did u implement the method actionPerformed in ur class PDL.
0
 
OviCommented:
import java,awt.Applet;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class xyz extends java.applet.Applet{
 public void init()
{
   Button b =new Button ("CUT");
   b.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent e) {
       ---here comes your implementation
       }
});
   add(b);
}
}


-------- tested and applied succesfully
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now