/[classpath]/classpath/javax/swing/JComponent.java
ViewVC logotype

Diff of /classpath/javax/swing/JComponent.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.80 by abalkiss, Wed Nov 9 21:59:40 2005 UTC revision 1.81 by abalkiss, Wed Nov 9 23:14:39 2005 UTC
# Line 2828  public abstract class JComponent extends Line 2828  public abstract class JComponent extends
2828     */     */
2829    public void addNotify()    public void addNotify()
2830    {    {
2831        // Register the WHEN_IN_FOCUSED_WINDOW keyboard bindings
2832        // Note that here we unregister all bindings associated with
2833        // this component and then re-register them.  This may be more than
2834        // necessary if the top-level ancestor hasn't changed.  Should
2835        // maybe improve this.
2836        KeyboardManager km = KeyboardManager.getManager();
2837        km.clearBindingsForComp(this);
2838        km.registerEntireMap((ComponentInputMap)
2839                             this.getInputMap(WHEN_IN_FOCUSED_WINDOW));
2840      super.addNotify();      super.addNotify();
2841    
     // 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.keys();  
         for (int i = 0; i < ikeys.length; i++)  
           {  
             Object o = input.get(ikeys[i]);  
             parentInput.put(ikeys[i], o);  
           }  
   
         Object[] akeys = actions.keys();  
         for (int i = 0; i < akeys.length; i++)  
           {  
             Action a = actions.get(akeys[i]);  
             parentAction.put(akeys[i], a);  
           }  
   
         parent = jParent.getParent();  
       }  
       
2842      // Notify AncestorListeners.      // Notify AncestorListeners.
2843      fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);      fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
2844    
2845      // fire property change event for 'ancestor'      // fire property change event for 'ancestor'
2846      firePropertyChange("ancestor", null, parent);      firePropertyChange("ancestor", null, getParent());
2847    }    }
2848    
2849    /**    /**

Legend:
Removed from v.1.80  
changed lines
  Added in v.1.81

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26