java.lang.Object
edu.stanford.genetics.treeview.ContainerFocusTracker
- All Implemented Interfaces:
- java.awt.event.ContainerListener, java.util.EventListener, java.awt.event.FocusListener
- public class ContainerFocusTracker
- extends java.lang.Object
- implements java.awt.event.FocusListener, java.awt.event.ContainerListener
Note: I, Alok, didn't write this class.
Class for Containers which won't take the keyboard focus.
Because of what appears to be a bug in Java 1.1, when you move the
focus on to a Frame, or other Container, it keeps the focus, rather
than handing it on to an appropriate tabstop inside it.
This class collects all focus events for the Container and its contents,
and will correct the problem. It also monitors the Container, and keeps
track if the focussed component is removed from the container.
To use, just create a tracker, passing it the Container you want to
deal with.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
version
static RCSVersion version
container
java.awt.Container container
focus
java.awt.Component focus
debug
static final boolean debug
- See Also:
- Constant Field Values
ContainerFocusTracker
public ContainerFocusTracker(java.awt.Container c)
componentAdded
public void componentAdded(java.awt.event.ContainerEvent e)
- Description copied from interface:
java.awt.event.ContainerListener
- This method is called when a component is added to the container.
- Specified by:
componentAdded
in interface java.awt.event.ContainerListener
componentRemoved
public void componentRemoved(java.awt.event.ContainerEvent e)
- Description copied from interface:
java.awt.event.ContainerListener
- This method is called when a component is removed from the container.
- Specified by:
componentRemoved
in interface java.awt.event.ContainerListener
focusGained
public void focusGained(java.awt.event.FocusEvent e)
- Description copied from interface:
java.awt.event.FocusListener
- This method is called when a component gains the keyboard focus.
- Specified by:
focusGained
in interface java.awt.event.FocusListener
focusLost
public void focusLost(java.awt.event.FocusEvent e)
- Description copied from interface:
java.awt.event.FocusListener
- This method is invoked when a component loses the keyboard focus.
- Specified by:
focusLost
in interface java.awt.event.FocusListener
switchFocus
private boolean switchFocus(java.awt.Container container)
addComponent
private void addComponent(java.awt.Component c)
addContainer
private void addContainer(java.awt.Container container)
removeComponent
private void removeComponent(java.awt.Component c)
removeContainer
private void removeContainer(java.awt.Container container)