public class FocusWatcher
extends java.lang.Object
implements java.awt.event.ContainerListener, java.awt.event.FocusListener
Constructor and Description |
---|
FocusWatcher() |
Modifier and Type | Method and Description |
---|---|
void |
componentAdded(java.awt.event.ContainerEvent e) |
void |
componentRemoved(java.awt.event.ContainerEvent e) |
void |
deinstall(java.awt.Component component) |
void |
deinstall(java.awt.Component component,
java.awt.AWTEvent cause) |
protected void |
focusedComponentChanged(java.awt.Component component,
java.awt.AWTEvent cause)
Override this method to get notifications about focus.
|
void |
focusGained(java.awt.event.FocusEvent e) |
void |
focusLost(java.awt.event.FocusEvent e) |
protected void |
focusLostImpl(java.awt.event.FocusEvent e) |
java.awt.Component |
getFocusedComponent() |
java.awt.Component |
getNearestFocusableComponent() |
java.awt.Component |
getTopComponent() |
void |
install(java.awt.Component component) |
protected boolean |
isFocusedComponentChangeValid(java.awt.Component component,
java.awt.AWTEvent cause) |
void |
setFocusedComponentImpl(java.awt.Component component) |
void |
setFocusedComponentImpl(java.awt.Component component,
java.awt.AWTEvent cause) |
public java.awt.Component getTopComponent()
null
if focus watcher was installed
on some component hierarchy.public final void componentAdded(java.awt.event.ContainerEvent e)
componentAdded
in interface java.awt.event.ContainerListener
public final void componentRemoved(java.awt.event.ContainerEvent e)
componentRemoved
in interface java.awt.event.ContainerListener
public final void deinstall(java.awt.Component component)
public final void deinstall(java.awt.Component component, java.awt.AWTEvent cause)
public final void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
public final void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
public final java.awt.Component getFocusedComponent()
null
.public final java.awt.Component getNearestFocusableComponent()
public final void install(java.awt.Component component)
public void setFocusedComponentImpl(java.awt.Component component)
public void setFocusedComponentImpl(java.awt.Component component, java.awt.AWTEvent cause)
protected boolean isFocusedComponentChangeValid(java.awt.Component component, java.awt.AWTEvent cause)
protected void focusedComponentChanged(java.awt.Component component, java.awt.AWTEvent cause)
FocusWatcher
invokes
this method each time one of the populated component gains focus. All "temporary" focus
event are ignored.component
- currently focused component. The component can be null
cause
- protected void focusLostImpl(java.awt.event.FocusEvent e)