This patch fixes the FIXME note in JMenuBar.removeNotify (yes, the one I put there about 10 minutes ago). The JMenuBar is now unregistered from the KeyboardManager.
2005-11-14 Anthony Balkissoon <[EMAIL PROTECTED]> * javax/swing/JMenuBar.java: (removeNotify): Unregister this JMenuBar from the KeyboardManager. * javax/swing/KeyboardManager.java: (unregisterJMenuBar): New implementation method. --Tony
Index: javax/swing/JMenuBar.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JMenuBar.java,v retrieving revision 1.20 diff -u -r1.20 JMenuBar.java --- javax/swing/JMenuBar.java 14 Nov 2005 20:58:47 -0000 1.20 +++ javax/swing/JMenuBar.java 14 Nov 2005 21:14:01 -0000 @@ -551,7 +551,7 @@ */ public void removeNotify() { - // FIXME: Must unregister this menu bar with the current keyboard manager. + KeyboardManager.getManager().unregisterJMenuBar(this); super.removeNotify(); } Index: javax/swing/KeyboardManager.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/KeyboardManager.java,v retrieving revision 1.3 diff -u -r1.3 KeyboardManager.java --- javax/swing/KeyboardManager.java 14 Nov 2005 20:23:56 -0000 1.3 +++ javax/swing/KeyboardManager.java 14 Nov 2005 21:14:01 -0000 @@ -263,4 +263,18 @@ if (!menuBars.contains(menuBar)) menuBars.add(menuBar); } + + /** + * Unregisters a JMenuBar from its top-level container. This is + * called before the JMenuBar is actually removed from the container + * so findTopLevel will still find us the correct top-level container. + * @param menuBar the JMenuBar to unregister. + */ + public void unregisterJMenuBar (JMenuBar menuBar) + { + Container topLevel = findTopLevel(menuBar); + Vector menuBars = getVectorForTopLevel(topLevel); + if (menuBars.contains(menuBar)) + menuBars.remove(menuBar); + } }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches