Abstract interface FocusListener in java

FocusListener interface defines the methods that an object must implement to “listen” for focus events on AWT components. When a FocusEvent occurs, an AWT component notifies its registered FocusListener objects by invoking one of their methods. An easy way to implement this interface is by subclassing the FocusAdapter class.

Objects that implement the FocusListener interface can receive FocusEvent objects. Listeners
must first register themselves with objects that produce events. When events occur, they are then automatically propagated to all registered listeners.

The structure of the interface FocusListener is given by

public abstract interface java.awt.event.FocusListener extends java.util.EventListener {
// Public Instance Methods
public abstract void focusGained(FocusEvent e);
public abstract void focusLost(FocusEvent e);
}

The details of the class structure are given as follows:

public abstract void focusGained(FocusEvent e);

public abstract void focusGained(FocusEvent e) method notifies the FocusListener that a component gained the input focus.

Parameter
e – The component event that occurred.

public abstract void focusLost(FocusEvent e);

public abstract void focusLost(FocusEvent e) method notifies the FocusListener that a component lost the input focus.

Parameter
e – The component event that occurred.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

I am the founder and owner of the blog - TechTravelHub.com, always love to share knowledge on test automation,tools,techniques and tips.I am a passionate coder of Java and VBScript.I also publish articles on Travel ideas and great honeymoon destinations.Apart from these, I am a gear-head,love to drive across India. I have shared lots of articles here on How to travel several parts of India.Customization of cars aka car modification is my another hobby.Get in touch with me on [email protected]

Write A Comment