answersLogoWhite

0


Best Answer

The ActionListener interface has a single method.

void actionPerformed(ActionEvent e) For full Java documentation see Oracle JavaDoc URL in related links below.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

1

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which methods are there in ActionListener interface?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How is interface instantiated in anonymous class for example new ActionListener?

They key word here is anonymous class. While ActionListener may be an interface, the anonymous class would be a subclass of ActionListener. It would be like creating a new class which implements ActionListener.JButton button = new JButton("Press Me!");button.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent ev) {System.out.println("PRESS");}});


What is an actionlistener?

An ActionListener is exactly what it sounds like. It's an interface used by other classes to listen for an action event. The simplest example of this is on a Button. Normally when you add a Button to a Component nothing will happen when you press it. You need to use a button.addActionListener(actionListener) call to make it listen for button clicks.


What is intrface in java?

interface is a list of methods which implements that interface


What is a tagging interface type?

A tagging interface type in Java is an interface that has not defined methods such as the java.io.Serializable interface.


What is interface in java?

Interface is collection of abstract methods which has only declaration and no implementation


What is interface incompatibility?

interface incompatibility means two inherited methods are not Override


Abstract class vs interface?

Comparison between an Abstract Class and an Interface:While an abstract class can define both abstract and non-abstract methods, an interface can have only abstract methods. Another way interfaces differ from abstract classes is that interfaces have very little flexibility in how the methods and variables defined in the interface are declared. These rules are strict:


What implicit modifiers interface methods have in java?

public


What is difference between interface and abstract in java?

While an abstract class can define both abstract and non-abstract methods, an interface can have only abstract methods. Another way interfaces differ from abstract classes is that interfaces have very little flexibility in how the methods and variables defined in the interface are declared. These rules are strict: • All interface methods are implicitly public and abstract. In other words, you do not need to actually type the public or abstract modifiers in the method declaration, but the method is still always public and abstract. (You can use any kind of modifiers in the Abstract class) • All variables defined in an interface must be public, static, and final-in other words, interfaces can declare only constants, not instance variables. • Interface methods must not be static. • Because interface methods are abstract, they cannot be marked final, strictfp, or native. (More on these modifiers later.) • An interface can extend one or more other interfaces. • An interface cannot extend anything but another interface. • An interface cannot implement another interface or class. • An interface must be declared with the keyword interface. You must remember that all interface methods are public and abstract regardless of what you see in the interface definition.


Why an interface can not have anything but constants and abstract methods?

The idea is that an interface is not a class, it is just a specification of what classes that implement it must contain.


What is the major difference between an Interface and a Class?

An interface can only have abstract methods or constants in it. A class can have both that and everything else in Java.


When would you use interface in java?

An Interface is nothing but a contract as to how a class should behave. It just declares the behavior as empty methods and the implementing class actually writes the code that will determine the behavior. When you implement an interface, you're agreeing to adhere to the contract defined in the interface. That means you're agreeing to provide legal implementations for every method defined in the interface, and that anyone who knows what the interface methods look like can rest assured that they can invoke those methods on an instance of your implementing class. (Thy need not bother much about how you have implemented it. All they bother about is whether a method of the name mentioned in the interface is available or not)