/[classpath]/classpath/javax/swing/plaf/basic/BasicListUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicListUI.java

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

revision 1.35 by rabbit78, Tue Oct 18 22:10:32 2005 UTC revision 1.36 by abalkiss, Thu Oct 20 18:58:47 2005 UTC
# Line 930  public class BasicListUI extends ListUI Line 930  public class BasicListUI extends ListUI
930      list.removeMouseMotionListener(mouseInputListener);      list.removeMouseMotionListener(mouseInputListener);
931      list.removePropertyChangeListener(propertyChangeListener);      list.removePropertyChangeListener(propertyChangeListener);
932    }    }
   
   private int convertModifiers(int mod)  
   {  
     if ((mod & KeyEvent.SHIFT_DOWN_MASK) != 0)  
       {  
         mod |= KeyEvent.SHIFT_MASK;  
         mod &= ~KeyEvent.SHIFT_DOWN_MASK;  
       }  
     if ((mod & KeyEvent.CTRL_DOWN_MASK) != 0)  
       {  
         mod |= KeyEvent.CTRL_MASK;  
         mod &= ~KeyEvent.CTRL_DOWN_MASK;  
       }  
     if ((mod & KeyEvent.META_DOWN_MASK) != 0)  
       {  
         mod |= KeyEvent.META_MASK;  
         mod &= ~KeyEvent.META_DOWN_MASK;  
       }  
     if ((mod & KeyEvent.ALT_DOWN_MASK) != 0)  
       {  
         mod |= KeyEvent.ALT_MASK;  
         mod &= ~KeyEvent.ALT_DOWN_MASK;  
       }  
     if ((mod & KeyEvent.ALT_GRAPH_DOWN_MASK) != 0)  
       {  
         mod |= KeyEvent.ALT_GRAPH_MASK;  
         mod &= ~KeyEvent.ALT_GRAPH_DOWN_MASK;  
       }  
     return mod;  
   }  
933        
934    /**    /**
935     * Installs keyboard actions for this UI in the {@link JList}.     * Installs keyboard actions for this UI in the {@link JList}.
# Line 974  public class BasicListUI extends ListUI Line 944  public class BasicListUI extends ListUI
944      action = new ListAction();      action = new ListAction();
945      Object keys[] = focusInputMap.allKeys();      Object keys[] = focusInputMap.allKeys();
946      // Register key bindings in the UI InputMap-ActionMap pair      // Register key bindings in the UI InputMap-ActionMap pair
     // Note that we register key bindings with both the old and new modifier  
     // masks: InputEvent.SHIFT_MASK and InputEvent.SHIFT_DOWN_MASK and so on.  
947      for (int i = 0; i < keys.length; i++)      for (int i = 0; i < keys.length; i++)
948        {        {
949          parentInputMap.put(KeyStroke.getKeyStroke          KeyStroke stroke = (KeyStroke)keys[i];
950                             (((KeyStroke)keys[i]).getKeyCode(), convertModifiers          String actionString = (String) focusInputMap.get(stroke);
951                              (((KeyStroke)keys[i]).getModifiers())),          parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(),
952                              (String)focusInputMap.get((KeyStroke)keys[i]));                                                    stroke.getModifiers()),
953                               actionString);
         parentInputMap.put(KeyStroke.getKeyStroke  
                            (((KeyStroke)keys[i]).getKeyCode(),  
                             ((KeyStroke)keys[i]).getModifiers()),  
                             (String)focusInputMap.get((KeyStroke)keys[i]));  
954    
955          parentActionMap.put          parentActionMap.put (actionString,
956          ((String)focusInputMap.get((KeyStroke)keys[i]), new ActionListenerProxy                               new ActionListenerProxy(action, actionString));
          (action, (String)focusInputMap.get((KeyStroke)keys[i])));  
957        }        }
958        // Register the new InputMap-ActionMap as the parents of the list's
959        // InputMap and ActionMap
960      parentInputMap.setParent(list.getInputMap().getParent());      parentInputMap.setParent(list.getInputMap().getParent());
961      parentActionMap.setParent(list.getActionMap().getParent());      parentActionMap.setParent(list.getActionMap().getParent());
962      list.getInputMap().setParent(parentInputMap);      list.getInputMap().setParent(parentInputMap);

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

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