Hi,

I was seeing a loop with an application using getPreferredSize() because
BasicToolBarUI was calling the layoutmanager directly. It should
actually just return null (as the default implementation of UIComponent
does) to get the layoutmanager to calculate the preferred size. On irc
Roman and I found two more issues like these.

2005-07-26  Mark Wielaard  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicScrollPaneUI.java
        (getPreferredSize): Removed.
        * javax/swing/plaf/basic/BasicTabbedPaneUI.java
        (getPreferredSize): Removed.
        * javax/swing/plaf/basic/BasicToolBarUI.java
        (getPreferredSize): Removed.

Committed,

Mark
Index: javax/swing/plaf/basic/BasicScrollPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,v
retrieving revision 1.11
diff -u -r1.11 BasicScrollPaneUI.java
--- javax/swing/plaf/basic/BasicScrollPaneUI.java	2 Jul 2005 20:32:50 -0000	1.11
+++ javax/swing/plaf/basic/BasicScrollPaneUI.java	26 Jul 2005 14:10:35 -0000
@@ -102,14 +102,6 @@
     return sl.minimumLayoutSize(c);
   }
 
-  public Dimension getPreferredSize(JComponent c) 
-  {
-    JScrollPane p = (JScrollPane ) c;
-    ScrollPaneLayout sl = (ScrollPaneLayout) p.getLayout();
-    return sl.preferredLayoutSize(c);
-  }
-
-
   public void paint(Graphics g, JComponent c)
   {      
     // do nothing; the normal painting-of-children algorithm, along with
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.23
diff -u -r1.23 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java	2 Jul 2005 20:32:50 -0000	1.23
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java	26 Jul 2005 14:10:35 -0000
@@ -1680,18 +1680,6 @@
   }
 
   /**
-   * This method returns the preferred size of the JTabbedPane.
-   *
-   * @param c The JComponent to find a size for.
-   *
-   * @return The preferred size.
-   */
-  public Dimension getPreferredSize(JComponent c)
-  {
-    return layoutManager.preferredLayoutSize(tabPane);
-  }
-
-  /**
    * This method returns the minimum size of the JTabbedPane.
    *
    * @param c The JComponent to find a size for.
Index: javax/swing/plaf/basic/BasicToolBarUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicToolBarUI.java,v
retrieving revision 1.10
diff -u -r1.10 BasicToolBarUI.java
--- javax/swing/plaf/basic/BasicToolBarUI.java	2 Jul 2005 20:32:50 -0000	1.10
+++ javax/swing/plaf/basic/BasicToolBarUI.java	26 Jul 2005 14:10:35 -0000
@@ -542,19 +542,6 @@
   }
 
   /**
-   * This method returns the preferred size of the given JComponent for this
-   * UI.
-   *
-   * @param c The JComponent to find a preferred size for.
-   *
-   * @return The preferred size for this UI.
-   */
-  public Dimension getPreferredSize(JComponent c)
-  {
-    return toolBar.getLayout().preferredLayoutSize(c);
-  }
-
-  /**
    * This method installs the needed components for the JToolBar.
    */
   protected void installComponents()

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to