Lillian pointed out that JComponent was giving some NPEs. This is
probably because last week I removed some unnecessary code from
addNotify but forgot to remove the corresponding code from removeNotify.
This is fixed now. While I was there I also added a FIXME note to
remind myself to remove the WHEN_IN_FOCUSED_WINDOW bindings for this
component, but first I have to write that capability into the
KeyboardManager. This will take some thought as I have to improve the
performance of KeyboardManager when it comes to removing/updating
bindings.
I also added a FIXME in JMenuBar's removeNotify to unregister the
JMenuBar. Again, I have to write the capability into the
KeyboardManager first. This one is pretty easy.
2005-11-14 Anthony Balkissoon <[EMAIL PROTECTED]>
* javax/swing/JComponent.java:
(removeNotify): Removed unncessary InputMap and ActionMap inheritance
code. Added FIXME to remove the WHEN_IN_FOCUSED_WINDOW bindings from
the KeyboardManager.
* javax/swing/JMenuBar.java:
(removeNotify): Added FIXME to unregister this JMenuBar from the
KeyboardManager.
--Tony
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.83
diff -u -r1.83 JComponent.java
--- javax/swing/JComponent.java 10 Nov 2005 20:03:55 -0000 1.83
+++ javax/swing/JComponent.java 14 Nov 2005 20:53:25 -0000
@@ -2921,37 +2921,14 @@
{
super.removeNotify();
- // let parents inherit the keybord mapping
- InputMap input = getInputMap();
- ActionMap actions = getActionMap();
-
- Container parent = getParent();
- while ((parent != null) && (parent instanceof JComponent))
- {
- JComponent jParent = (JComponent) parent;
- InputMap parentInput = jParent.getInputMap();
- ActionMap parentAction = jParent.getActionMap();
-
- KeyStroke[] ikeys = input.allKeys();
- for (int i = 0; i < ikeys.length; i++)
- {
- parentInput.remove(ikeys[i]);
- }
-
- Object[] akeys = actions.allKeys();
- for (int i = 0; i < akeys.length; i++)
- {
- parentAction.remove(akeys[i]);
- }
-
- parent = jParent.getParent();
- }
-
+ // FIXME: remove the WHEN_IN_FOCUSED_WINDOW bindings from the
+ // KeyboardManager
+
// Notify ancestor listeners.
fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
// fire property change event for 'ancestor'
- firePropertyChange("ancestor", parent, null);
+ firePropertyChange("ancestor", getParent(), null);
}
/**
Index: javax/swing/JMenuBar.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JMenuBar.java,v
retrieving revision 1.19
diff -u -r1.19 JMenuBar.java
--- javax/swing/JMenuBar.java 14 Nov 2005 20:23:56 -0000 1.19
+++ javax/swing/JMenuBar.java 14 Nov 2005 20:53:25 -0000
@@ -551,7 +551,7 @@
*/
public void removeNotify()
{
- // Must unregister this menu bar with the current keyboard manager.
+ // FIXME: Must unregister this menu bar with the current keyboard manager.
super.removeNotify();
}
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches