| 
JSR-62 (Final) | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
  |
  +--java.util.EventObject
        |
        +--java.awt.AWTEvent
              |
              +--java.awt.event.ComponentEvent
                    |
                    +--java.awt.event.FocusEvent
A low-level event which indicates that a component has gained
 or lost the keyboard focus.
 This low-level event is generated by a component (such as a text field).
 The event is passed to every FocusListener
 or FocusAdapter object which registered to receive such
 events using the component's addFocusListener method.
 (FocusAdapter objects implement the 
 FocusListener interface.) Each such listener object 
 gets this FocusEvent when the event occurs.
 
There are two levels of focus change events: permanent and temporary. Permanent focus change events occur when focus is directly moved from one component to another, such as through calls to requestFocus() or as the user uses the Tab key to traverse components. Temporary focus change events occur when focus is temporarily gained or lost for a component as the indirect result of another operation, such as window deactivation or a scrollbar drag. In this case, the original focus state will automatically be restored once that operation is finished, or, for the case of window deactivation, when the window is reactivated. Both permanent and temporary focus events are delivered using the FOCUS_GAINED and FOCUS_LOST event ids; the levels may be distinguished in the event using the isTemporary() method.
FocusAdapter, 
FocusListener, 
Tutorial: Writing a Focus Listener, 
Reference: The Java Class Libraries (update file), 
Serialized Form| Field Summary | |
static int | 
FOCUS_FIRST
The first number in the range of ids used for focus events.  | 
static int | 
FOCUS_GAINED
This event indicates that the component gained the keyboard focus.  | 
static int | 
FOCUS_LAST
The last number in the range of ids used for focus events.  | 
static int | 
FOCUS_LOST
This event indicates that the component lost the keyboard focus.  | 
| Fields inherited from class java.awt.event.ComponentEvent | 
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN | 
| Fields inherited from class java.awt.AWTEvent | 
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, id, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK | 
| Fields inherited from class java.util.EventObject | 
source | 
| Constructor Summary | |
FocusEvent(Component source,
           int id)
Constructs a FocusEvent object and identifies it as a permanent change in focus.  | 
|
FocusEvent(Component source,
           int id,
           boolean temporary)
Constructs a FocusEvent object and identifies whether or not the change is temporary.  | 
|
| Method Summary | |
 boolean | 
isTemporary()
Identifies the focus change event as temporary or permanent.  | 
 String | 
paramString()
Returns a parameter string identifying this event.  | 
| Methods inherited from class java.awt.event.ComponentEvent | 
getComponent | 
| Methods inherited from class java.awt.AWTEvent | 
consume, finalize, getID, isConsumed, toString | 
| Methods inherited from class java.util.EventObject | 
getSource | 
| Methods inherited from class java.lang.Object | 
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
public static final int FOCUS_FIRST
public static final int FOCUS_LAST
public static final int FOCUS_GAINED
public static final int FOCUS_LOST
| Constructor Detail | 
public FocusEvent(Component source,
                  int id,
                  boolean temporary)
source - the Component that originated the eventid - an integer indicating the type of eventtemporary - a boolean, true if the focus change is temporary
public FocusEvent(Component source,
                  int id)
source - the Component that originated the eventid - an integer indicating the type of event| Method Detail | 
public boolean isTemporary()
public String paramString()
paramString in class ComponentEvent
  | 
JSR-62 (Final) | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||