--- /home/cpdev/src/classpath/java/awt/DefaultKeyboardFocusManager.java	2005-07-06 05:32:54.000000000 +0000
+++ java/awt/DefaultKeyboardFocusManager.java	2005-06-30 05:34:25.000000000 +0000
@@ -140,12 +140,6 @@
     }
   }
 
-  /**
-   * This flag indicates for which focus traversal key release event we
-   * possibly wait, before letting any more KEY_TYPED events through.
-   */
-  private AWTKeyStroke waitForKeyStroke = null;
-
   /** The {@link java.util.SortedSet} of current {@link
       #EventDelayRequest}s. */
   private SortedSet delayRequests = new TreeSet ();
@@ -187,26 +181,20 @@
 
             // Keep track of this window's focus owner.
 
-            // Find the target Component's top-level ancestor.  target
-            // may be a window.
+            // Find the target Component's top-level ancestor.
             Container parent = target.getParent ();
 
             while (parent != null
                    && !(parent instanceof Window))
               parent = parent.getParent ();
 
-            // If the parent is null and target is not a window, then target is an
-            // unanchored component and so we don't want to set the focus owner.
-            if (! (parent == null && ! (target instanceof Window)))
-              {
-                Window toplevel = parent == null ?
-                  (Window) target : (Window) parent;
+            Window toplevel = parent == null ?
+              (Window) target : (Window) parent;
 
-                Component focusOwner = getFocusOwner ();
-                if (focusOwner != null
-                    && ! (focusOwner instanceof Window))
-                  toplevel.setFocusOwner (focusOwner);
-              }
+            Component focusOwner = getFocusOwner ();
+            if (focusOwner != null
+                && ! (focusOwner instanceof Window))
+              toplevel.setFocusOwner (focusOwner);
           }
         else if (e.id == FocusEvent.FOCUS_LOST)
           {
@@ -369,33 +357,10 @@
     // the other two key event types for the same key (e.g. if
     // KEY_PRESSED TAB is a focus traversal keystroke, we also need to
     // consume KEY_RELEASED and KEY_TYPED TAB key events).
-    // consuming KEY_RELEASED is easy, because their keyCodes matches
-    // the KEY_PRESSED event. Consuming the intermediate KEY_TYPED is
-    // very difficult because their is no clean way that we can know
-    // which KEY_TYPED belongs to a focusTraversalKey and which not.
-    // To address this problem we swallow every KEY_TYPE between the
-    // KEY_PRESSED event that matches a focusTraversalKey and the
-    // corresponding KEY_RELEASED.
     AWTKeyStroke oppositeKeystroke = AWTKeyStroke.getAWTKeyStroke (e.getKeyCode (),
                                                                    e.getModifiersEx (),
                                                                    !(e.id == KeyEvent.KEY_RELEASED));
 
-    // Here we check if we are currently waiting for a KEY_RELEASED and
-    // swallow all KeyEvents that are to be delivered in between. This
-    // should only be the KEY_TYPED events that correspond to the
-    // focusTraversalKey's KEY_PRESSED event
-    if (waitForKeyStroke != null)
-      {
-        if (eventKeystroke.equals(waitForKeyStroke))
-          // release this lock
-          waitForKeyStroke = null;
-
-        // as long as we are waiting for the KEY_RELEASED, we swallow every
-        // KeyEvent, including the KEY_RELEASED
-        e.consume();
-        return;
-      }
-
     Set forwardKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
     Set backwardKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
     Set upKeystrokes = comp.getFocusTraversalKeys (KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS);
@@ -405,29 +370,31 @@
 
     if (forwardKeystrokes.contains (eventKeystroke))
       {
-        waitForKeyStroke = oppositeKeystroke;        
         focusNextComponent (comp);
         e.consume ();
       }
     else if (backwardKeystrokes.contains (eventKeystroke))
       {
-        waitForKeyStroke = oppositeKeystroke;        
         focusPreviousComponent (comp);
         e.consume ();
       }
     else if (upKeystrokes.contains (eventKeystroke))
       {
-        waitForKeyStroke = oppositeKeystroke;        
         upFocusCycle (comp);
         e.consume ();
       }
     else if (comp instanceof Container
              && downKeystrokes.contains (eventKeystroke))
       {
-        waitForKeyStroke = oppositeKeystroke;        
         downFocusCycle ((Container) comp);
         e.consume ();
       }
+    else if (forwardKeystrokes.contains (oppositeKeystroke)
+             || backwardKeystrokes.contains (oppositeKeystroke)
+             || upKeystrokes.contains (oppositeKeystroke)
+             || (comp instanceof Container &&
+                 downKeystrokes.contains (oppositeKeystroke)))
+      e.consume ();
   }
 
   protected void enqueueKeyEvents (long after, Component untilFocused)
