All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface GraphicPlotter.KeyEventProcessor

public interface KeyEventProcessor
Interface that makes processKeyEvent public. Used to allow a component that listens to key events to forward the key events that it is not interesed in to its enclosing container.

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);
          }
       }
    }
 


Method Index

 o processKeyEvent(KeyEvent)

Methods

 o processKeyEvent
 public abstract void processKeyEvent(KeyEvent e)

All Packages  Class Hierarchy  This Package  Previous  Next  Index