java.awt.event
Interface FocusListener

All Superinterfaces:
EventListener sample code for java.util.EventListener definition code for java.util.EventListener
All Known Implementing Classes:
AWTEventMulticaster sample code for java.awt.AWTEventMulticaster definition code for java.awt.AWTEventMulticaster , BasicButtonListener sample code for javax.swing.plaf.basic.BasicButtonListener definition code for javax.swing.plaf.basic.BasicButtonListener , BasicComboBoxEditor sample code for javax.swing.plaf.basic.BasicComboBoxEditor definition code for javax.swing.plaf.basic.BasicComboBoxEditor , BasicComboBoxEditor.UIResource sample code for javax.swing.plaf.basic.BasicComboBoxEditor.UIResource definition code for javax.swing.plaf.basic.BasicComboBoxEditor.UIResource , BasicComboBoxUI.FocusHandler sample code for javax.swing.plaf.basic.BasicComboBoxUI.FocusHandler definition code for javax.swing.plaf.basic.BasicComboBoxUI.FocusHandler , BasicListUI.FocusHandler sample code for javax.swing.plaf.basic.BasicListUI.FocusHandler definition code for javax.swing.plaf.basic.BasicListUI.FocusHandler , BasicSliderUI.FocusHandler sample code for javax.swing.plaf.basic.BasicSliderUI.FocusHandler definition code for javax.swing.plaf.basic.BasicSliderUI.FocusHandler , BasicSplitPaneUI.FocusHandler sample code for javax.swing.plaf.basic.BasicSplitPaneUI.FocusHandler definition code for javax.swing.plaf.basic.BasicSplitPaneUI.FocusHandler , BasicTabbedPaneUI.FocusHandler sample code for javax.swing.plaf.basic.BasicTabbedPaneUI.FocusHandler definition code for javax.swing.plaf.basic.BasicTabbedPaneUI.FocusHandler , BasicTableUI.FocusHandler sample code for javax.swing.plaf.basic.BasicTableUI.FocusHandler definition code for javax.swing.plaf.basic.BasicTableUI.FocusHandler , BasicTextUI.BasicCaret sample code for javax.swing.plaf.basic.BasicTextUI.BasicCaret definition code for javax.swing.plaf.basic.BasicTextUI.BasicCaret , BasicToolBarUI.ToolBarFocusListener sample code for javax.swing.plaf.basic.BasicToolBarUI.ToolBarFocusListener definition code for javax.swing.plaf.basic.BasicToolBarUI.ToolBarFocusListener , BasicTreeUI.FocusHandler sample code for javax.swing.plaf.basic.BasicTreeUI.FocusHandler definition code for javax.swing.plaf.basic.BasicTreeUI.FocusHandler , Component.AccessibleAWTComponent.AccessibleAWTFocusHandler sample code for java.awt.Component.AccessibleAWTComponent.AccessibleAWTFocusHandler definition code for java.awt.Component.AccessibleAWTComponent.AccessibleAWTFocusHandler , DefaultCaret sample code for javax.swing.text.DefaultCaret definition code for javax.swing.text.DefaultCaret , FocusAdapter sample code for java.awt.event.FocusAdapter definition code for java.awt.event.FocusAdapter , JComponent.AccessibleJComponent.AccessibleFocusHandler sample code for javax.swing.JComponent.AccessibleJComponent.AccessibleFocusHandler definition code for javax.swing.JComponent.AccessibleJComponent.AccessibleFocusHandler , MetalComboBoxEditor sample code for javax.swing.plaf.metal.MetalComboBoxEditor definition code for javax.swing.plaf.metal.MetalComboBoxEditor , MetalComboBoxEditor.UIResource sample code for javax.swing.plaf.metal.MetalComboBoxEditor.UIResource definition code for javax.swing.plaf.metal.MetalComboBoxEditor.UIResource

public interface FocusListener
extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener

The listener interface for receiving keyboard focus events on a component. The class that is interested in processing a focus event either implements this interface (and all the methods it contains) or extends the abstract FocusAdapter class (overriding only the methods of interest). The listener object created from that class is then registered with a component using the component's addFocusListener method. When the component gains or loses the keyboard focus, the relevant method in the listener object is invoked, and the FocusEvent is passed to it.

Since:
1.1
See Also:
FocusAdapter sample code for java.awt.event.FocusAdapter definition code for java.awt.event.FocusAdapter , FocusEvent sample code for java.awt.event.FocusEvent definition code for java.awt.event.FocusEvent , Tutorial: Writing a Focus Listener, Reference: The Java Class Libraries (update file)

Method Summary
 void focusGained sample code for java.awt.event.FocusListener.focusGained(java.awt.event.FocusEvent) definition code for java.awt.event.FocusListener.focusGained(java.awt.event.FocusEvent) (FocusEvent sample code for java.awt.event.FocusEvent definition code for java.awt.event.FocusEvent  e)
          Invoked when a component gains the keyboard focus.
 void focusLost sample code for java.awt.event.FocusListener.focusLost(java.awt.event.FocusEvent) definition code for java.awt.event.FocusListener.focusLost(java.awt.event.FocusEvent) (FocusEvent sample code for java.awt.event.FocusEvent definition code for java.awt.event.FocusEvent  e)
          Invoked when a component loses the keyboard focus.
 

Method Detail

focusGained sample code for java.awt.event.FocusListener.focusGained(java.awt.event.FocusEvent) definition code for java.awt.event.FocusListener.focusGained(java.awt.event.FocusEvent)

void focusGained(FocusEvent sample code for java.awt.event.FocusEvent definition code for java.awt.event.FocusEvent  e)
Invoked when a component gains the keyboard focus.


focusLost sample code for java.awt.event.FocusListener.focusLost(java.awt.event.FocusEvent) definition code for java.awt.event.FocusListener.focusLost(java.awt.event.FocusEvent)

void focusLost(FocusEvent sample code for java.awt.event.FocusEvent definition code for java.awt.event.FocusEvent  e)
Invoked when a component loses the keyboard focus.