bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug swing/26027] The new element, added to JList, does not appear (regr


From: audriusa at bluewin dot ch
Subject: [Bug swing/26027] The new element, added to JList, does not appear (regression since 0.20)
Date: 30 Jan 2006 07:34:12 -0000


------- Comment #2 from audriusa at bluewin dot ch  2006-01-30 07:34 -------
(From update of attachment 10757)
Index: BasicListUI.java
===================================================================
RCS file:
/sources/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v
retrieving revision 1.52
diff -u -r1.52 BasicListUI.java
--- BasicListUI.java    28 Jan 2006 20:34:00 -0000      1.52
+++ BasicListUI.java    30 Jan 2006 07:33:15 -0000
@@ -720,19 +720,12 @@
     int minIndex = Math.min(index1, index2);
     int maxIndex = Math.max(index1, index2);
     Point loc = indexToLocation(list, minIndex);
-
-    // When the layoutOrientation is VERTICAL, then the width == the list
-    // width. Otherwise the cellWidth field is used.
-    int width = cellWidth;
-    if (l.getLayoutOrientation() == JList.VERTICAL)
-      width = l.getWidth();
-
-    Rectangle bounds = new Rectangle(loc.x, loc.y, width,
+    Rectangle bounds = new Rectangle(loc.x, loc.y, cellWidth,
                                      getCellHeight(minIndex));
     for (int i = minIndex + 1; i <= maxIndex; i++)
       {
         Point hiLoc = indexToLocation(list, i);
-        Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, width,
+        Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth,
                                            getCellHeight(i));
         bounds = bounds.union(hibounds);
       }
@@ -890,6 +883,8 @@
             Dimension dim = flyweight.getPreferredSize();
             cellWidth = Math.max(cellWidth, dim.width);
           }
+        if (list.getLayoutOrientation() == JList.VERTICAL)
+          cellWidth = Math.max(cellWidth, list.getSize().width);
       }
   }

@@ -899,7 +894,7 @@
    */
   protected void maybeUpdateLayoutState()
   {
-    if (updateLayoutStateNeeded != 0)
+    if (updateLayoutStateNeeded != 0 || !list.isValid())
       {
         updateLayoutState();
         updateLayoutStateNeeded = 0;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26027





reply via email to

[Prev in Thread] Current Thread [Next in Thread]