Class UIFocusEvent
public class UIFocusEvent extends UIEvent
{
// Fields
public static final int FOCUS_GAINED;
public static final int FOCUS_LOST;
// Constructors
public UIFocusEvent(IUIComponent source, int id);
public UIFocusEvent(IUIComponent source, int id,
IUIComponent arg);
public UIFocusEvent(IUIComponent source, int id,
boolean temporary);
public UIFocusEvent(IUIComponent source, int id,
IUIComponent arg, boolean temporary);
// Methods
public IUIComponent getArg();
public boolean isTemporary();
public String paramString();
}
This class represents the component-level focus event. Focus change events occur when focus is moved directly from one component to another, such as through calls to requestFocus or as the user presses the TAB key to traverse components.
Focus events are delivered by using the FOCUS_GAINED and FOCUS_LOST event identifiers.
EventObject
|
+--UIBaseEvent
|
+--UIEvent
|
+--UIFocusEvent
public UIFocusEvent(IUIComponent source, int id);
Creates a permanent-level UIFocusEvent object with the specified source component and type.
Parameter | Description |
source
| The object where the event originated.
|
id
| The event type.
|
public UIFocusEvent(IUIComponent source, int id, IUIComponent arg);
Creates a permanent-level UIFocusEvent object with the specified source component and type.
Parameter | Description |
source
| The object where the event originated.
|
id
| The event type.
|
arg
| The target object of the event.
|
Remarks:
If the identifier is FOCUS_GAINED, the arg component is the component that loses focus. If the identifier is FOCUS_LOST, the arg component is the component that gains focus.
public UIFocusEvent(IUIComponent source, int id, boolean temporary);
Creates a UIFocusEvent object with the specified source component, type, and whether the focus event is a temporary level event.
Parameter | Description |
source
| The object where the event originated.
|
id
| The event type.
|
temporary
| Set to true if the focus change is temporary.
|
public UIFocusEvent(IUIComponent source, int id, IUIComponent arg,
boolean temporary);
Creates a UIFocusEvent object with the specified source component, type, and whether the focus event is a temporary level event.
Parameter | Description |
source
| The object where the event originated.
|
id
| The event type.
|
arg
| The target object of the event.
|
temporary
| Set to true if the focus change is temporary.
|
Remarks:
If the identifier is FOCUS_GAINED, the arg component is the component that loses focus. If the identifier is FOCUS_LOST, the arg component is the component that gains focus.
public IUIComponent getArg();
Retrieves the target component of the event.
Return Value:
Returns the target IUIComponent of the event.
Remarks:
If the identifier is FOCUS_GAINED, the returned component is the component that loses focus. If the identifier is FOCUS_LOST, the returned component is the component that gains focus.
public boolean isTemporary();
Determines whether this focus change event is a temporary change. 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.
Return Value:
Returns true if the focus change event is a temporary one.
public String paramString();
This method is used internally by the toString method.
Return Value:
Returns a formatted String object that assists with textual representation of the exception.
See Also: com.ms.ui.event.UIBaseEvent.toString
- FOCUS_GAINED
- The focus gained event type.
- FOCUS_LOST
- The focus lost event type.