Class FocusEvent
public class FocusEvent extends java.awt.event.FocusEvent
{
// Constructors
public FocusEvent(Component source, int id, Component other,
boolean temporary);
public FocusEvent(Component source, int id, Component other);
// Methods
public Component getOtherComponent();
public String paramString();
}
This class manages component-level focus events. This class is similar to the java.awt.event.FocusEvent class, except that it also incorporates the target component of a component focus event.
FocusEvent
|
+--FocusEvent
public FocusEvent(Component source, int id, Component other,
boolean temporary);
Creates a FocusEvent object by using the component that received the focus, the component that lost focus, the identifier of the focus event, and whether the focus event is temporary or permanent.
Parameter | Description |
source
| The component that generates the event.
|
other
| The target component.
|
id
| The identifier of the focus event. This may be either FOCUS_LOST or FOCUS_GAINED.
If the identifier is FOCUS_GAINED, the other component is the component that loses focus. If the identifier is FOCUS_LOST, the other component is the component that gains focus. However, if the application is currently gaining or losing focus, the identifier may be null.
|
temporary
| Set to true if the focus change is a temporary one. Set to false if the focus change is a permanent one.
|
public FocusEvent(Component source, int id, Component other);
Creates a FocusEvent object by using the component that received the focus, the component that lost focus, and the identifier of the focus event. A FocusEvent created with this constructor is permanent (by default).
Parameter | Description |
source
| The component that generates the event.
|
other
| The target component.
|
id
| The identifier of the focus event. This may be either FOCUS_LOST or FOCUS_GAINED.
If the identifier is FOCUS_GAINED, the other component is the component that loses focus. If the identifier is FOCUS_LOST, the other component is the component that gains focus. However, if the application is currently gaining or losing focus, the identifier may be null.
|
public Component getOtherComponent();
Retrieves the target component involved in the focus shift.
Return Value:
Returns the other component involved in the focus change (if any).
public String paramString();
Describes the focus event.
Return Value:
Returns a string that describes the focus event ("FOCUS_LOST other= other", for example).