Fixed the width of the JFileChooser.

2006-01-03  Lillian Angel  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicListUI.java
        (getPreferredSize): The JDK adds some extra space to
        the list, so we should as well.
        * javax/swing/plaf/metal/MetalFileChooserUI.java
        (getPreferredSize): Should only take the fileListPanel's
        width into account when getting the size. Also, the 
        buttonPanel's size should not be checked, since it is in the 
        bottomPanel already. (getMinimumSize): Likewise.

Index: javax/swing/plaf/basic/BasicListUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v
retrieving revision 1.44
diff -u -r1.44 BasicListUI.java
--- javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 15:53:54 -0000	1.44
+++ javax/swing/plaf/basic/BasicListUI.java	3 Jan 2006 16:42:33 -0000
@@ -1087,6 +1087,7 @@
     int layoutOrientation = list.getLayoutOrientation();
     Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1);
     Dimension retVal = bounds.getSize();
+    retVal.width += cellWidth;
     Component parent = list.getParent();
     if ((visibleRows == -1) && (parent instanceof JViewport))
       {
Index: javax/swing/plaf/metal/MetalFileChooserUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java,v
retrieving revision 1.15
diff -u -r1.15 MetalFileChooserUI.java
--- javax/swing/plaf/metal/MetalFileChooserUI.java	3 Jan 2006 16:13:48 -0000	1.15
+++ javax/swing/plaf/metal/MetalFileChooserUI.java	3 Jan 2006 16:42:34 -0000
@@ -1653,14 +1653,10 @@
   {
     Dimension tp = topPanel.getPreferredSize();
     Dimension bp = bottomPanel.getPreferredSize();
-    Dimension bup = buttonPanel.getPreferredSize();
     Dimension fl = fileListPanel.getPreferredSize();
-    return new Dimension((tp.width +
-        bp.width + bup.width + fl.width), 
-        (tp.height + bp.height +
-         bup.height + fl.height));
+    return new Dimension(fl.width, tp.height + bp.height + fl.height);
   }
-  
+
   /**
    * Returns the minimum size for the file chooser component.
    * 
@@ -1670,12 +1666,8 @@
   {
     Dimension tp = topPanel.getMinimumSize();
     Dimension bp = bottomPanel.getMinimumSize();
-    Dimension bup = buttonPanel.getMinimumSize();
     Dimension fl = fileListPanel.getMinimumSize();
-    return new Dimension((tp.width +
-        bp.width + bup.width + fl.width), 
-        (tp.height + bp.height +
-         bup.height + fl.height));   
+    return new Dimension(fl.width, tp.height + bp.height + fl.height);
   }
   
   /**
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to