--- /home/cpdev/src/classpath/javax/swing/plaf/basic/BasicListUI.java	2005-07-14 05:32:45.000000000 +0000
+++ javax/swing/plaf/basic/BasicListUI.java	2005-06-30 05:35:18.000000000 +0000
@@ -49,8 +49,6 @@
 import java.awt.event.ComponentListener;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -95,7 +93,7 @@
   }
 
   /**
-   * A helper class which listens for {@link FocusEvent}s
+   * A helper class which listens for {@link FocusEvents}
    * from the JList.
    */
   public class FocusHandler implements FocusListener
@@ -133,7 +131,7 @@
    * A helper class which listens for {@link ListDataEvent}s generated by
    * the {@link JList}'s {@link ListModel}.
    *
-   * @see javax.swing.JList#getModel()
+   * @see javax.swing.JList#model
    */
   public class ListDataHandler implements ListDataListener
   {
@@ -186,98 +184,6 @@
   }
 
   /**
-   * A helper class which listens for {@link KeyEvents}s 
-   * from the {@link JList}.
-   */
-  private class KeyHandler extends KeyAdapter
-  {
-    public KeyHandler()
-    {
-    }
-    
-    public void keyPressed( KeyEvent evt ) 
-    {
-      int lead = BasicListUI.this.list.getLeadSelectionIndex();
-      int max = BasicListUI.this.list.getModel().getSize() - 1;
-      // Do nothing if list is empty
-      if (max == -1)
-        return;
-
-      // Process the key event.  Bindings can be found in
-      // javax.swing.plaf.basic.BasicLookAndFeel.java
-      if ((evt.getKeyCode() == KeyEvent.VK_DOWN)
-          || (evt.getKeyCode() == KeyEvent.VK_KP_DOWN))
-        {
-          if (!evt.isShiftDown())
-            {
-              BasicListUI.this.list.clearSelection();
-              BasicListUI.this.list.setSelectedIndex(Math.min(lead+1,max));
-            }
-          else 
-            {
-              BasicListUI.this.list.getSelectionModel().
-                setLeadSelectionIndex(Math.min(lead+1,max));
-            }
-        }
-      else if ((evt.getKeyCode() == KeyEvent.VK_UP)
-               || (evt.getKeyCode() == KeyEvent.VK_KP_UP))
-        {
-          if (!evt.isShiftDown())
-            {
-              BasicListUI.this.list.clearSelection();
-              BasicListUI.this.list.setSelectedIndex(Math.max(lead-1,0));
-            }
-          else
-            {
-              BasicListUI.this.list.getSelectionModel().
-                setLeadSelectionIndex(Math.max(lead-1,0));
-            }
-        }
-      else if (evt.getKeyCode() == KeyEvent.VK_PAGE_UP)
-        {
-          // FIXME: implement, need JList.ensureIndexIsVisible to work
-        }
-      else if (evt.getKeyCode() == KeyEvent.VK_PAGE_DOWN)
-        {
-          // FIXME: implement, need JList.ensureIndexIsVisible to work
-        }
-      else if (evt.getKeyCode() == KeyEvent.VK_BACK_SLASH
-               && evt.isControlDown())
-        {
-            BasicListUI.this.list.clearSelection();
-        }
-      else if ((evt.getKeyCode() == KeyEvent.VK_HOME)
-               || evt.getKeyCode() == KeyEvent.VK_END)
-        {
-          // index is either 0 for HOME, or last cell for END
-          int index = (evt.getKeyCode() == KeyEvent.VK_HOME) ? 0 : max;
-          
-          if (!evt.isShiftDown() ||(BasicListUI.this.list.getSelectionMode() 
-                                    == ListSelectionModel.SINGLE_SELECTION))
-            BasicListUI.this.list.setSelectedIndex(index);
-          else if (BasicListUI.this.list.getSelectionMode() == 
-                   ListSelectionModel.SINGLE_INTERVAL_SELECTION)
-            BasicListUI.this.list.setSelectionInterval
-              (BasicListUI.this.list.getAnchorSelectionIndex(), index);
-          else
-            BasicListUI.this.list.getSelectionModel().
-              setLeadSelectionIndex(index);
-        }
-      else if ((evt.getKeyCode() == KeyEvent.VK_A || evt.getKeyCode()
-                == KeyEvent.VK_SLASH) && evt.isControlDown())
-        {
-          BasicListUI.this.list.setSelectionInterval(0, max);
-        }
-      else if (evt.getKeyCode() == KeyEvent.VK_SPACE && evt.isControlDown())
-        {
-          BasicListUI.this.list.getSelectionModel().
-            setLeadSelectionIndex(Math.min(lead+1,max));
-        }
-      
-    }
-  }
-  
-  /**
    * A helper class which listens for {@link MouseEvent}s 
    * from the {@link JList}.
    */
@@ -291,46 +197,6 @@
      */
     public void mouseClicked(MouseEvent event)
     {
-      Point click = event.getPoint();
-      int index = BasicListUI.this.locationToIndex(list, click);
-      if (index == -1)
-        return;
-      if (event.isControlDown())
-        {
-          if (BasicListUI.this.list.getSelectionMode() == 
-              ListSelectionModel.SINGLE_SELECTION)
-            BasicListUI.this.list.setSelectedIndex(index);
-          else if (BasicListUI.this.list.isSelectedIndex(index))
-            BasicListUI.this.list.removeSelectionInterval(index,index);
-          else
-            BasicListUI.this.list.addSelectionInterval(index,index);
-        }
-      else if (event.isShiftDown())
-        {
-          if (BasicListUI.this.list.getSelectionMode() == 
-              ListSelectionModel.SINGLE_SELECTION)
-            BasicListUI.this.list.setSelectedIndex(index);
-          else if (BasicListUI.this.list.getSelectionMode() == 
-                   ListSelectionModel.SINGLE_INTERVAL_SELECTION)
-            // COMPAT: the IBM VM is compatible with the following line of code.
-            // However, compliance with Sun's VM would correspond to replacing 
-            // getAnchorSelectionIndex() with getLeadSelectionIndex().This is 
-            // both unnatural and contradictory to the way they handle other 
-            // similar UI interactions.
-            BasicListUI.this.list.setSelectionInterval
-              (BasicListUI.this.list.getAnchorSelectionIndex(), index);
-          else
-            // COMPAT: both Sun and IBM are compatible instead with:
-            // BasicListUI.this.list.setSelectionInterval
-            //     (BasicListUI.this.list.getLeadSelectionIndex(),index);
-            // Note that for IBM this is contradictory to what they did in 
-            // the above situation for SINGLE_INTERVAL_SELECTION.  
-            // The most natural thing to do is the following:
-            BasicListUI.this.list.getSelectionModel().
-              setLeadSelectionIndex(index);
-        }
-      else
-        BasicListUI.this.list.setSelectedIndex(index);
     }
 
     /**
@@ -341,6 +207,12 @@
      */
     public void mousePressed(MouseEvent event)
     {
+      Point click = event.getPoint();
+      int index = BasicListUI.this.locationToIndex(list, click);
+      if (index == -1)
+        return;
+
+      BasicListUI.this.list.setSelectedIndex(index);
     }
 
     /**
@@ -432,23 +304,19 @@
   }
 
   /** The current focus listener. */
-  protected FocusListener focusListener;
+  protected FocusHandler focusListener;
 
   /** The data listener listening to the model. */
-  protected ListDataListener listDataListener;
+  protected ListDataHandler listDataListener;
 
   /** The selection listener listening to the selection model. */
-  protected ListSelectionListener listSelectionListener;
+  protected ListSelectionHandler listSelectionListener;
 
   /** The mouse listener listening to the list. */
-  protected MouseInputListener mouseInputListener;
-
-  /** The key listener listening to the list */
-  private KeyHandler keyListener;
+  protected MouseInputHandler mouseInputListener;
 
   /** The property change listener listening to the list. */
-  protected PropertyChangeListener propertyChangeListener;
-
+  protected PropertyChangeHandler propertyChangeListener;
 
   /** The component listener that receives notification for resizing the
    * JList component.*/
@@ -630,6 +498,7 @@
   void damageLayout()
   {
     updateLayoutStateNeeded = 1;
+    list.revalidate();
   }
 
   /**
@@ -654,7 +523,6 @@
     listDataListener = new ListDataHandler();
     listSelectionListener = new ListSelectionHandler();
     mouseInputListener = new MouseInputHandler();
-    keyListener = new KeyHandler();
     propertyChangeListener = new PropertyChangeHandler();
     componentListener = new ComponentHandler();
     updateLayoutStateNeeded = 1;
@@ -702,7 +570,6 @@
     list.getModel().addListDataListener(listDataListener);
     list.addListSelectionListener(listSelectionListener);
     list.addMouseListener(mouseInputListener);
-    list.addKeyListener(keyListener);
     list.addMouseMotionListener(mouseInputListener);
     list.addPropertyChangeListener(propertyChangeListener);
     list.addComponentListener(componentListener);
@@ -717,7 +584,6 @@
     list.getModel().removeListDataListener(listDataListener);
     list.removeListSelectionListener(listSelectionListener);
     list.removeMouseListener(mouseInputListener);
-    list.removeKeyListener(keyListener);
     list.removeMouseMotionListener(mouseInputListener);
     list.removePropertyChangeListener(propertyChangeListener);
   }
