java.awt.event
Class FocusEvent
java.lang.Object
|
+--java.util.EventObject
|
+--java.awt.AWTEvent
|
+--java.awt.event.ComponentEvent
|
+--java.awt.event.FocusEvent
This class represents an event generated when a focus change occurs for a
component. There are both temporary changes, such as when focus is stolen
during a sroll then returned, and permanent changes, such as when the user
TABs through focusable components.
Since:Author:- Aaron M. Renn <arenn@urbanophile.com>
See Also:
FOCUS_FIRST
public static final int FOCUS_FIRST
This is the first id in the range of ids used by this class.
FOCUS_GAINED
public static final int FOCUS_GAINED
This is the event id for a focus gained event.
FOCUS_LAST
public static final int FOCUS_LAST
This is the last id in the range of ids used by this class.
FOCUS_LOST
public static final int FOCUS_LOST
This is the event id for a focus lost event.
FocusEvent
public FocusEvent(java.awt.Component source, int id)
Initializes a new instance of FocusEvent
with the
specified source and id. Note that an invalid id leads to unspecified
results.
Parameters:
Throws:
FocusEvent
public FocusEvent(java.awt.Component source, int id, boolean temporary)
Initializes a new instance of FocusEvent
with the
specified source, id, and temporary status. Note that an invalid id
leads to unspecified results.
Parameters:
Throws:
FocusEvent
public FocusEvent(java.awt.Component source, int id, boolean temporary, java.awt.Component opposite)
Initializes a new instance of FocusEvent
with the
specified source, id, temporary status, and opposite counterpart. Note
that an invalid id leads to unspecified results.
Parameters:
Throws:
getOppositeComponent
public Component getOppositeComponent()
Returns the component which received the opposite focus event. If this
component gained focus, the opposite lost focus; likewise if this
component is giving up focus, the opposite is gaining it. If this
information is unknown, perhaps because the opposite is a native
application, this returns null.
Since:Returns:
- the component with the focus opposite, or null
isTemporary
public boolean isTemporary()
This method tests whether or not the focus change is temporary or
permanent.
Returns:
- true if the focus change is temporary
paramString
public String paramString()
Returns a string identifying this event. This is formatted as:
(getID() == FOCUS_GAINED ? "FOCUS_GAINED" : "FOCUS_LOST")
+ (isTemporary() ? ",temporary," : ",permanent,") + "opposite="
+ getOppositeComponent()
.
Returns:
- a string identifying this event