< prev index next >

src/java.desktop/share/classes/java/awt/DefaultKeyboardFocusManager.java

Print this page

        

*** 307,322 **** * current KeyboardFocusManager dispatch the specified event on its behalf. * DefaultKeyboardFocusManagers dispatch all FocusEvents, all WindowEvents * related to focus, and all KeyEvents. These events are dispatched based * on the KeyboardFocusManager's notion of the focus owner and the focused * and active Windows, sometimes overriding the source of the specified ! * AWTEvent. If this method returns <code>false</code>, then the AWT event * dispatcher will attempt to dispatch the event itself. * * @param e the AWTEvent to be dispatched ! * @return <code>true</code> if this method dispatched the event; ! * <code>false</code> otherwise */ public boolean dispatchEvent(AWTEvent e) { if (focusLog.isLoggable(PlatformLogger.Level.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) { focusLog.fine("" + e); } --- 307,322 ---- * current KeyboardFocusManager dispatch the specified event on its behalf. * DefaultKeyboardFocusManagers dispatch all FocusEvents, all WindowEvents * related to focus, and all KeyEvents. These events are dispatched based * on the KeyboardFocusManager's notion of the focus owner and the focused * and active Windows, sometimes overriding the source of the specified ! * AWTEvent. If this method returns {@code false}, then the AWT event * dispatcher will attempt to dispatch the event itself. * * @param e the AWTEvent to be dispatched ! * @return {@code true} if this method dispatched the event; ! * {@code false} otherwise */ public boolean dispatchEvent(AWTEvent e) { if (focusLog.isLoggable(PlatformLogger.Level.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) { focusLog.fine("" + e); }
*** 776,801 **** return true; } /** ! * Called by <code>dispatchEvent</code> if no other * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or * if no other KeyEventDispatchers are registered. If the event has not * been consumed, its target is enabled, and the focus owner is not null, * this method dispatches the event to its target. This method will also * subsequently dispatch the event to all registered * KeyEventPostProcessors. After all this operations are finished, * the event is passed to peers for processing. * <p> ! * In all cases, this method returns <code>true</code>, since * DefaultKeyboardFocusManager is designed so that neither ! * <code>dispatchEvent</code>, nor the AWT event dispatcher, should take * further action on the event in any situation. * * @param e the KeyEvent to be dispatched ! * @return <code>true</code> * @see Component#dispatchEvent */ public boolean dispatchKeyEvent(KeyEvent e) { Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent(); --- 776,801 ---- return true; } /** ! * Called by {@code dispatchEvent} if no other * KeyEventDispatcher in the dispatcher chain dispatched the KeyEvent, or * if no other KeyEventDispatchers are registered. If the event has not * been consumed, its target is enabled, and the focus owner is not null, * this method dispatches the event to its target. This method will also * subsequently dispatch the event to all registered * KeyEventPostProcessors. After all this operations are finished, * the event is passed to peers for processing. * <p> ! * In all cases, this method returns {@code true}, since * DefaultKeyboardFocusManager is designed so that neither ! * {@code dispatchEvent}, nor the AWT event dispatcher, should take * further action on the event in any situation. * * @param e the KeyEvent to be dispatched ! * @return {@code true} * @see Component#dispatchEvent */ public boolean dispatchKeyEvent(KeyEvent e) { Component focusOwner = (((AWTEvent)e).isPosted) ? getFocusOwner() : e.getComponent();
*** 839,855 **** return true; } /** ! * This method will be called by <code>dispatchKeyEvent</code>. It will * handle any unconsumed KeyEvents that map to an AWT ! * <code>MenuShortcut</code> by consuming the event and activating the * shortcut. * * @param e the KeyEvent to post-process ! * @return <code>true</code> * @see #dispatchKeyEvent * @see MenuShortcut */ public boolean postProcessKeyEvent(KeyEvent e) { if (!e.isConsumed()) { --- 839,855 ---- return true; } /** ! * This method will be called by {@code dispatchKeyEvent}. It will * handle any unconsumed KeyEvents that map to an AWT ! * {@code MenuShortcut} by consuming the event and activating the * shortcut. * * @param e the KeyEvent to post-process ! * @return {@code true} * @see #dispatchKeyEvent * @see MenuShortcut */ public boolean postProcessKeyEvent(KeyEvent e) { if (!e.isConsumed()) {
*** 996,1006 **** return true; } } /** ! * Returns true if there are some marker associated with component <code>comp</code> * in a markers' queue * @since 1.5 */ private boolean hasMarker(Component comp) { for (Iterator<TypeAheadMarker> iter = typeAheadMarkers.iterator(); iter.hasNext(); ) { --- 996,1006 ---- return true; } } /** ! * Returns true if there are some marker associated with component {@code comp} * in a markers' queue * @since 1.5 */ private boolean hasMarker(Component comp) { for (Iterator<TypeAheadMarker> iter = typeAheadMarkers.iterator(); iter.hasNext(); ) {
*** 1199,1209 **** /** * Delays dispatching of KeyEvents until the specified Component becomes * the focus owner. KeyEvents with timestamps later than the specified * timestamp will be enqueued until the specified Component receives a * FOCUS_GAINED event, or the AWT cancels the delay request by invoking ! * <code>dequeueKeyEvents</code> or <code>discardKeyEvents</code>. * * @param after timestamp of current event, or the current, system time if * the current event has no timestamp, or the AWT cannot determine * which event is currently being handled * @param untilFocused Component which will receive a FOCUS_GAINED event --- 1199,1209 ---- /** * Delays dispatching of KeyEvents until the specified Component becomes * the focus owner. KeyEvents with timestamps later than the specified * timestamp will be enqueued until the specified Component receives a * FOCUS_GAINED event, or the AWT cancels the delay request by invoking ! * {@code dequeueKeyEvents} or {@code discardKeyEvents}. * * @param after timestamp of current event, or the current, system time if * the current event has no timestamp, or the AWT cannot determine * which event is currently being handled * @param untilFocused Component which will receive a FOCUS_GAINED event
*** 1239,1257 **** } /** * Releases for normal dispatching to the current focus owner all * KeyEvents which were enqueued because of a call to ! * <code>enqueueKeyEvents</code> with the same timestamp and Component. * If the given timestamp is less than zero, the outstanding enqueue * request for the given Component with the <b>oldest</b> timestamp (if * any) should be cancelled. * * @param after the timestamp specified in the call to ! * <code>enqueueKeyEvents</code>, or any value &lt; 0 * @param untilFocused the Component specified in the call to ! * <code>enqueueKeyEvents</code> * @see #enqueueKeyEvents * @see #discardKeyEvents */ protected synchronized void dequeueKeyEvents(long after, Component untilFocused) { --- 1239,1257 ---- } /** * Releases for normal dispatching to the current focus owner all * KeyEvents which were enqueued because of a call to ! * {@code enqueueKeyEvents} with the same timestamp and Component. * If the given timestamp is less than zero, the outstanding enqueue * request for the given Component with the <b>oldest</b> timestamp (if * any) should be cancelled. * * @param after the timestamp specified in the call to ! * {@code enqueueKeyEvents}, or any value &lt; 0 * @param untilFocused the Component specified in the call to ! * {@code enqueueKeyEvents} * @see #enqueueKeyEvents * @see #discardKeyEvents */ protected synchronized void dequeueKeyEvents(long after, Component untilFocused) {
*** 1290,1304 **** } } /** * Discards all KeyEvents which were enqueued because of one or more calls ! * to <code>enqueueKeyEvents</code> with the specified Component, or one of * its descendants. * * @param comp the Component specified in one or more calls to ! * <code>enqueueKeyEvents</code>, or a parent of such a Component * @see #enqueueKeyEvents * @see #dequeueKeyEvents */ protected synchronized void discardKeyEvents(Component comp) { if (comp == null) { --- 1290,1304 ---- } } /** * Discards all KeyEvents which were enqueued because of one or more calls ! * to {@code enqueueKeyEvents} with the specified Component, or one of * its descendants. * * @param comp the Component specified in one or more calls to ! * {@code enqueueKeyEvents}, or a parent of such a Component * @see #enqueueKeyEvents * @see #dequeueKeyEvents */ protected synchronized void discardKeyEvents(Component comp) { if (comp == null) {
< prev index next >