Right after my last patch I noticed that now we could focus more than
one component at a time (at least visually). The problem is a mistake in
KeyboardFocusManager.get(Global)FocusOwner(), these methods shouldn't
check for the permanent owner and simply return the current focusOwner.
I checked this against the JDK behaviour.
2006-07-26 Roman Kennke <[EMAIL PROTECTED]>
* java/awt/KeyboardFocusManager.java
(getFocusOwner): Don't check permanent owner.
(getGlobalFocusOwner): Don't check permanent owner.
/Roman
Index: java/awt/KeyboardFocusManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/KeyboardFocusManager.java,v
retrieving revision 1.18
diff -u -1 -2 -r1.18 KeyboardFocusManager.java
--- java/awt/KeyboardFocusManager.java 26 Jul 2006 19:09:50 -0000 1.18
+++ java/awt/KeyboardFocusManager.java 26 Jul 2006 19:39:28 -0000
@@ -295,47 +295,41 @@
currentKeyboardFocusManagers.put (currentGroup, manager);
}
/**
* Retrieve the [EMAIL PROTECTED] Component} that has the keyboard focus, or
* null if the focus owner was not set by a thread in the current
* [EMAIL PROTECTED] java.lang.ThreadGroup}.
*
* @return the keyboard focus owner or null
*/
public Component getFocusOwner ()
{
- Component owner = (Component) getObject (currentFocusOwners);
- if (owner == null)
- owner = (Component) getObject (currentPermanentFocusOwners);
- return owner;
+ return (Component) getObject (currentFocusOwners);
}
/**
* Retrieve the [EMAIL PROTECTED] Component} that has the keyboard focus,
* regardless of whether or not it was set by a thread in the
* current [EMAIL PROTECTED] java.lang.ThreadGroup}. If there is no temporary
* focus owner in effect then this method will return the same value
* as [EMAIL PROTECTED] #getGlobalPermanentFocusOwner}.
*
* @return the keyboard focus owner
* @throws SecurityException if this is not the keyboard focus
* manager associated with the current [EMAIL PROTECTED] java.lang.ThreadGroup}
*/
protected Component getGlobalFocusOwner ()
{
- // Check if there is a temporary focus owner.
- Component focusOwner = (Component) getGlobalObject (currentFocusOwners);
-
- return (focusOwner == null) ? getGlobalPermanentFocusOwner () : focusOwner;
+ return (Component) getGlobalObject(currentFocusOwners);
}
/**
* Set the [EMAIL PROTECTED] Component} that will be returned by [EMAIL PROTECTED]
* #getFocusOwner} (when it is called from the current [EMAIL PROTECTED]
* java.lang.ThreadGroup}) and [EMAIL PROTECTED] #getGlobalFocusOwner}. This
* method does not actually transfer the keyboard focus.
*
* @param owner the Component to return from getFocusOwner and
* getGlobalFocusOwner
*
* @see Component#requestFocus()