The component-level focus event.
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 scroll bar 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
Constructs a permanent-level FocusEvent object with the specified source component and type.
Constructs a FocusEvent object with the specified source component, type, and whether or not the focus event is a temporary level event.
Method Detail
FocusEvent(Component, int)
Constructs a permanent-level FocusEvent object with the specified source component and type.
sssssFocusEvent(Component, int, boolean)
Constructs a FocusEvent object with the specified source component, type, and whether or not the focus event is a temporary level event.
Method Detail
isTemporary
public boolean isTemporary()
- Identifies the focus change event as temporary or permanent.
-
- Returns:
true
if the focus change is temporary;false
otherwise
getOppositeComponent
public Component getOppositeComponent()
Returns the other Component involved in this focus change.
For a FOCUS_GAINED event, this is the Component that lost focus. For a FOCUS_LOST event, this is the Component that gained focus.
If this focus change occurs with a native application, with a Java application in a different VM or context, or with no other Component, then null is returned.
-
- Returns:
- the other Component involved in the focus change, or null
paramString
public String paramString()
- Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.
-
- Overrides:
paramString
in classComponentEvent
-
- Returns:
- a string identifying the event and its attributes
0 comments:
Post a Comment