The method BasicTextUI.createKeymap() used to store a KeyBinding[] into
the UIManager focusInputMap for the text component. This is certainly
wrong. If at all the KeyBinding[] should be stored as prefix +
".bindings". However I think that this method should not even do this.
AFAICS no Swing class stores anything into the UIManager (except the
LookAndFeel classes of course).

Also, this method seems to be implemented wrong at all. For details look
at the FIXME that I added and this bugreport that I filed for this:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26045

I committed this small fix for now to make my application working:

2006-01-31  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicTextUI.java
        (createKeymap): Don't store KeyBindings[] as focusInputMap in
        UIManager. Added FIXME regarding the implementation of this
method.

/Roman
Index: javax/swing/plaf/basic/BasicTextUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTextUI.java,v
retrieving revision 1.62
diff -u -r1.62 BasicTextUI.java
--- javax/swing/plaf/basic/BasicTextUI.java	22 Dec 2005 16:04:56 -0000	1.62
+++ javax/swing/plaf/basic/BasicTextUI.java	31 Jan 2006 09:27:46 -0000
@@ -621,6 +621,11 @@
    */
   protected Keymap createKeymap()
   {
+    // FIXME: It seems to me that this method implementation is wrong. It seems
+    // to fetch the focusInputMap and transform it to the KeyBinding/Keymap
+    // implemenation. I would think that it should be done the other way,
+    // fetching the keybindings (from prefix + ".bindings") and transform
+    // it to the newer InputMap/ActionMap implementation.
     JTextComponent.KeyBinding[] bindings = null;
     String prefix = getPropertyPrefix();
     InputMapUIResource m = (InputMapUIResource) UIManager.get(prefix + ".focusInputMap");
@@ -637,10 +642,7 @@
           }
       }
     if (bindings == null)
-      {
-        bindings = new JTextComponent.KeyBinding[0];
-        UIManager.put(prefix + ".focusInputMap", bindings);
-      }
+      bindings = new JTextComponent.KeyBinding[0];
 
     Keymap km = JTextComponent.addKeymap(getKeymapName(), 
                                          JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP));    

Reply via email to