src/share/classes/java/awt/event/FocusAdapter.java

Print this page




  27 
  28 /**
  29  * An abstract adapter class for receiving keyboard focus events.
  30  * The methods in this class are empty. This class exists as
  31  * convenience for creating listener objects.
  32  * <P>
  33  * Extend this class to create a <code>FocusEvent</code> listener
  34  * and override the methods for the events of interest. (If you implement the
  35  * <code>FocusListener</code> interface, you have to define all of
  36  * the methods in it. This abstract class defines null methods for them
  37  * all, so you can only have to define methods for events you care about.)
  38  * <P>
  39  * Create a listener object using the extended class and then register it with
  40  * a component using the component's <code>addFocusListener</code>
  41  * method. When the component gains or loses the keyboard focus,
  42  * the relevant method in the listener object is invoked,
  43  * and the <code>FocusEvent</code> is passed to it.
  44  *
  45  * @see FocusEvent
  46  * @see FocusListener
  47  * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/focuslistener.html">Tutorial: Writing a Focus Listener</a>
  48  *
  49  * @author Carl Quinn
  50  * @since 1.1
  51  */
  52 public abstract class FocusAdapter implements FocusListener {
  53     /**
  54      * Invoked when a component gains the keyboard focus.
  55      */
  56     public void focusGained(FocusEvent e) {}
  57 
  58     /**
  59      * Invoked when a component loses the keyboard focus.
  60      */
  61     public void focusLost(FocusEvent e) {}
  62 }


  27 
  28 /**
  29  * An abstract adapter class for receiving keyboard focus events.
  30  * The methods in this class are empty. This class exists as
  31  * convenience for creating listener objects.
  32  * <P>
  33  * Extend this class to create a <code>FocusEvent</code> listener
  34  * and override the methods for the events of interest. (If you implement the
  35  * <code>FocusListener</code> interface, you have to define all of
  36  * the methods in it. This abstract class defines null methods for them
  37  * all, so you can only have to define methods for events you care about.)
  38  * <P>
  39  * Create a listener object using the extended class and then register it with
  40  * a component using the component's <code>addFocusListener</code>
  41  * method. When the component gains or loses the keyboard focus,
  42  * the relevant method in the listener object is invoked,
  43  * and the <code>FocusEvent</code> is passed to it.
  44  *
  45  * @see FocusEvent
  46  * @see FocusListener
  47  * @see <a href="http://docs.oracle.com/javase/tutorial/uiswing/events/focuslistener.html">Tutorial: Writing a Focus Listener</a>
  48  *
  49  * @author Carl Quinn
  50  * @since 1.1
  51  */
  52 public abstract class FocusAdapter implements FocusListener {
  53     /**
  54      * Invoked when a component gains the keyboard focus.
  55      */
  56     public void focusGained(FocusEvent e) {}
  57 
  58     /**
  59      * Invoked when a component loses the keyboard focus.
  60      */
  61     public void focusLost(FocusEvent e) {}
  62 }