fds.micro.ui.events
Class FocusEvent

java.lang.Object
  extended byfds.micro.ui.events.EventUI
      extended byfds.micro.ui.events.FocusEvent

public class FocusEvent
extends EventUI

This class is used with Component sub-classes for focus events.

Author:
Frédéric DE STEUR

Field Summary
static int FOCUS_GAINED
          Define the constant for a gained focus event.
static int FOCUS_LOST
          Define the constant for a lost focus event.
 
Constructor Summary
FocusEvent(Component source, int type)
          Build a focus event raised by given source component.
FocusEvent(Component source, int type, Component oppositeComponent)
          Build a focus event raised by given source component.
 
Method Summary
 Component getOppositeComponent()
          Get the opposite component.
 int getType()
          Get the event type.
 java.lang.String toString()
          Give String description of this event.
 
Methods inherited from class fds.micro.ui.events.EventUI
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FOCUS_GAINED

public static final int FOCUS_GAINED
Define the constant for a gained focus event.

See Also:
Constant Field Values

FOCUS_LOST

public static final int FOCUS_LOST
Define the constant for a lost focus event.

See Also:
Constant Field Values
Constructor Detail

FocusEvent

public FocusEvent(Component source,
                  int type)
Build a focus event raised by given source component.

Parameters:
source - The component that have produced the event.
type - The event type. Must be FOCUS_LOST or FOCUS_GAINED.

FocusEvent

public FocusEvent(Component source,
                  int type,
                  Component oppositeComponent)
Build a focus event raised by given source component.

Parameters:
source - The component that have produced the event.
type - The event type. Must be FOCUS_LOST or FOCUS_GAINED.
oppositeComponent - The opposite component. i.e. if type=FOCUS_LOST this is the component that have gained the focus, and if type=FOCUS_GAINED this is the component that have lost the focus.
Method Detail

getOppositeComponent

public Component getOppositeComponent()
Get the opposite component. i.e. if type=FOCUS_LOST this is the component that have gained the focus, and if type=FOCUS_GAINED this is the component that have lost the focus.

Returns:
Returns the opposite component. Returns null if no component had the focus (type=FOCUS_GAINED) or no component gained the focus (type=FOCUS_LOST).

getType

public int getType()
Get the event type.

Returns:
Returns FOCUS_LOST or FOCUS_GAINED constant.

toString

public java.lang.String toString()
Description copied from class: EventUI
Give String description of this event.

Overrides:
toString in class EventUI