Index: javax/swing/SwingUtilities.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/javax/swing/SwingUtilities.java,v retrieving revision 1.6.2.17 diff -u -r1.6.2.17 SwingUtilities.java --- javax/swing/SwingUtilities.java 21 Nov 2004 11:25:33 -0000 1.6.2.17 +++ javax/swing/SwingUtilities.java 21 Jan 2005 11:23:47 -0000 @@ -47,6 +47,7 @@ import java.awt.Frame; import java.awt.Graphics; import java.awt.Insets; +import java.awt.KeyboardFocusManager; import java.awt.Point; import java.awt.Rectangle; import java.awt.Shape; @@ -129,6 +130,37 @@ } /** + * Returns the focus owner or null if comp is not + * the focus owner or a parent of it. + * + * @param comp the focus owner or a parent of it + * + * @return the focus owner, or null + * + * @deprecated 1.4 Replaced by + * KeyboardFocusManager.getFocusOwner(). + */ + public static Component findFocusOwner(Component comp) + { + // Get real focus owner. + Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager() + .getFocusOwner(); + + // Check if comp is the focus owner or a parent of it. + Component tmp = focusOwner; + + while (tmp != null) + { + if (tmp == comp) + return focusOwner; + + tmp = tmp.getParent(); + } + + return null; + } + + /** * Calculates the bounds of a component in the component's own coordinate * space. The result has the same height and width as the component's * bounds, but its location is set to (0,0).