0N/A/*
2362N/A * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage java.awt;
0N/A
0N/Aimport java.awt.event.KeyEvent;
0N/A
0N/A
0N/A/**
0N/A * A KeyEventDispatcher cooperates with the current KeyboardFocusManager in the
0N/A * targeting and dispatching of all KeyEvents. KeyEventDispatchers registered
0N/A * with the current KeyboardFocusManager will receive KeyEvents before they are
0N/A * dispatched to their targets, allowing each KeyEventDispatcher to retarget
0N/A * the event, consume it, dispatch the event itself, or make other changes.
0N/A * <p>
0N/A * Note that KeyboardFocusManager itself implements KeyEventDispatcher. By
0N/A * default, the current KeyboardFocusManager will be the sink for all KeyEvents
0N/A * not dispatched by the registered KeyEventDispatchers. The current
0N/A * KeyboardFocusManager cannot be completely deregistered as a
0N/A * KeyEventDispatcher. However, if a KeyEventDispatcher reports that it
0N/A * dispatched the KeyEvent, regardless of whether it actually did so, the
0N/A * KeyboardFocusManager will take no further action with regard to the
0N/A * KeyEvent. (While it is possible for client code to register the current
0N/A * KeyboardFocusManager as a KeyEventDispatcher one or more times, this is
0N/A * usually unnecessary and not recommended.)
0N/A *
0N/A * @author David Mendenhall
0N/A *
0N/A * @see KeyboardFocusManager#addKeyEventDispatcher
0N/A * @see KeyboardFocusManager#removeKeyEventDispatcher
0N/A * @since 1.4
0N/A */
0N/Apublic interface KeyEventDispatcher {
0N/A
0N/A /**
0N/A * This method is called by the current KeyboardFocusManager requesting
0N/A * that this KeyEventDispatcher dispatch the specified event on its behalf.
0N/A * This KeyEventDispatcher is free to retarget the event, consume it,
0N/A * dispatch it itself, or make other changes. This capability is typically
0N/A * used to deliver KeyEvents to Components other than the focus owner. This
0N/A * can be useful when navigating children of non-focusable Windows in an
0N/A * accessible environment, for example. Note that if a KeyEventDispatcher
0N/A * dispatches the KeyEvent itself, it must use <code>redispatchEvent</code>
0N/A * to prevent the current KeyboardFocusManager from recursively requesting
0N/A * that this KeyEventDispatcher dispatch the event again.
0N/A * <p>
0N/A * If an implementation of this method returns <code>false</code>, then
0N/A * the KeyEvent is passed to the next KeyEventDispatcher in the chain,
0N/A * ending with the current KeyboardFocusManager. If an implementation
0N/A * returns <code>true</code>, the KeyEvent is assumed to have been
0N/A * dispatched (although this need not be the case), and the current
0N/A * KeyboardFocusManager will take no further action with regard to the
0N/A * KeyEvent. In such a case,
0N/A * <code>KeyboardFocusManager.dispatchEvent</code> should return
0N/A * <code>true</code> as well. If an implementation consumes the KeyEvent,
0N/A * but returns <code>false</code>, the consumed event will still be passed
0N/A * to the next KeyEventDispatcher in the chain. It is important for
0N/A * developers to check whether the KeyEvent has been consumed before
0N/A * dispatching it to a target. By default, the current KeyboardFocusManager
0N/A * will not dispatch a consumed KeyEvent.
0N/A *
0N/A * @param e the KeyEvent to dispatch
0N/A * @return <code>true</code> if the KeyboardFocusManager should take no
0N/A * further action with regard to the KeyEvent; <code>false</code>
0N/A * otherwise
0N/A * @see KeyboardFocusManager#redispatchEvent
0N/A */
0N/A boolean dispatchKeyEvent(KeyEvent e);
0N/A}