All Packages Class Hierarchy This Package Previous Next Index
It would have been nice if the Container.postProcessKeyEvent method did not have the default visibility modifier (which restricts its use to the java.awt package). Because it does, we need to implement our own way to propagate unconsumed key events up the containment hierarchy.
Containers that are interested in key events that are not consumed by components they contain implement this interface. Components that want to propagate uncomsumed key events up the containment hierarchy override the processKeyEvent method as follows.
protected void processKeyEvent(KeyEvent e) { super.processKeyEvent(); if (! e.isConsumed()) { Container parent = getParent(); if (parent instanceof KeyEventProcessor) { ((KeyEventProcessor)parent).processKeyEvent(e); } } }
public abstract void processKeyEvent(KeyEvent e)
All Packages Class Hierarchy This Package Previous Next Index