< prev index next >
src/java.desktop/share/classes/java/awt/event/FocusEvent.java
Print this page
*** 30,44 ****
import sun.awt.SunToolkit;
/**
* A low-level event which indicates that a Component has gained or lost the
* input focus. This low-level event is generated by a Component (such as a
! * TextField). The event is passed to every <code>FocusListener</code> or
! * <code>FocusAdapter</code> object which registered to receive such events
! * using the Component's <code>addFocusListener</code> method. (<code>
! * FocusAdapter</code> objects implement the <code>FocusListener</code>
! * interface.) Each such listener object gets this <code>FocusEvent</code> when
* the event occurs.
* <p>
* There are two levels of focus events: permanent and temporary. Permanent
* focus change events occur when focus is directly moved from one Component to
* another, such as through a call to requestFocus() or as the user uses the
--- 30,44 ----
import sun.awt.SunToolkit;
/**
* A low-level event which indicates that a Component has gained or lost the
* input focus. This low-level event is generated by a Component (such as a
! * TextField). The event is passed to every {@code FocusListener} or
! * {@code FocusAdapter} object which registered to receive such events
! * using the Component's {@code addFocusListener} method.
! * ({@code FocusAdapter} objects implement the {@code FocusListener}
! * interface.) Each such listener object gets this {@code FocusEvent} when
* the event occurs.
* <p>
* There are two levels of focus events: permanent and temporary. Permanent
* focus change events occur when focus is directly moved from one Component to
* another, such as through a call to requestFocus() or as the user uses the
*** 112,145 ****
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = 523753786457416396L;
/**
! * Constructs a <code>FocusEvent</code> object with the
! * specified temporary state and opposite <code>Component</code>.
! * The opposite <code>Component</code> is the other
! * <code>Component</code> involved in this focus change.
! * For a <code>FOCUS_GAINED</code> event, this is the
! * <code>Component</code> that lost focus. For a
! * <code>FOCUS_LOST</code> event, this is the <code>Component</code>
* that gained focus. If this focus change occurs with a native
* application, with a Java application in a different VM,
! * or with no other <code>Component</code>, then the opposite
! * <code>Component</code> is <code>null</code>.
* <p> This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
*
! * @param source The <code>Component</code> that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link FocusEvent}
! * @param temporary Equals <code>true</code> if the focus change is temporary;
! * <code>false</code> otherwise
* @param opposite The other Component involved in the focus change,
! * or <code>null</code>
! * @throws IllegalArgumentException if <code>source</code> equals {@code null}
* @see #getSource()
* @see #getID()
* @see #isTemporary()
* @see #getOppositeComponent()
* @since 1.4
--- 112,145 ----
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = 523753786457416396L;
/**
! * Constructs a {@code FocusEvent} object with the
! * specified temporary state and opposite {@code Component}.
! * The opposite {@code Component} is the other
! * {@code Component} involved in this focus change.
! * For a {@code FOCUS_GAINED} event, this is the
! * {@code Component} that lost focus. For a
! * {@code FOCUS_LOST} event, this is the {@code Component}
* that gained focus. If this focus change occurs with a native
* application, with a Java application in a different VM,
! * or with no other {@code Component}, then the opposite
! * {@code Component} is {@code null}.
* <p> This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
*
! * @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link FocusEvent}
! * @param temporary Equals {@code true} if the focus change is temporary;
! * {@code false} otherwise
* @param opposite The other Component involved in the focus change,
! * or {@code null}
! * @throws IllegalArgumentException if {@code source} equals {@code null}
* @see #getSource()
* @see #getID()
* @see #isTemporary()
* @see #getOppositeComponent()
* @since 1.4
*** 150,204 ****
this.temporary = temporary;
this.opposite = opposite;
}
/**
! * Constructs a <code>FocusEvent</code> object and identifies
* whether or not the change is temporary.
* <p> This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
*
! * @param source The <code>Component</code> that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link FocusEvent}
! * @param temporary Equals <code>true</code> if the focus change is temporary;
! * <code>false</code> otherwise
! * @throws IllegalArgumentException if <code>source</code> equals {@code null}
* @see #getSource()
* @see #getID()
* @see #isTemporary()
*/
public FocusEvent(Component source, int id, boolean temporary) {
this(source, id, temporary, null);
}
/**
! * Constructs a <code>FocusEvent</code> object and identifies it
* as a permanent change in focus.
* <p> This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
*
! * @param source The <code>Component</code> that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link FocusEvent}
! * @throws IllegalArgumentException if <code>source</code> equals {@code null}
* @see #getSource()
* @see #getID()
*/
public FocusEvent(Component source, int id) {
this(source, id, false);
}
/**
* Identifies the focus change event as temporary or permanent.
*
! * @return <code>true</code> if the focus change is temporary;
! * <code>false</code> otherwise
*/
public boolean isTemporary() {
return temporary;
}
--- 150,204 ----
this.temporary = temporary;
this.opposite = opposite;
}
/**
! * Constructs a {@code FocusEvent} object and identifies
* whether or not the change is temporary.
* <p> This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
*
! * @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link FocusEvent}
! * @param temporary Equals {@code true} if the focus change is temporary;
! * {@code false} otherwise
! * @throws IllegalArgumentException if {@code source} equals {@code null}
* @see #getSource()
* @see #getID()
* @see #isTemporary()
*/
public FocusEvent(Component source, int id, boolean temporary) {
this(source, id, temporary, null);
}
/**
! * Constructs a {@code FocusEvent} object and identifies it
* as a permanent change in focus.
* <p> This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
*
! * @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link FocusEvent}
! * @throws IllegalArgumentException if {@code source} equals {@code null}
* @see #getSource()
* @see #getID()
*/
public FocusEvent(Component source, int id) {
this(source, id, false);
}
/**
* Identifies the focus change event as temporary or permanent.
*
! * @return {@code true} if the focus change is temporary;
! * {@code false} otherwise
*/
public boolean isTemporary() {
return temporary;
}
< prev index next >