[kaffe] CVS kaffe (robilad): Resynced with GNU classpath: swing fixlet

Kaffe CVS cvs-commits at kaffe.org
Wed Mar 2 14:19:23 PST 2005


PatchSet 5612 
Date: 2005/03/02 22:14:32
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU classpath: swing fixlet

2005-03-02  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-02-26  Roman Kennke  <roman at ontographics.com>

        * javax/swing/plaf/basic/BasicListUI
        (updateLayoutState,paint): make BasicListUI aware of the
        width of the rendered JList

Members: 
	ChangeLog:1.3657->1.3658 
	libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3657 kaffe/ChangeLog:1.3658
--- kaffe/ChangeLog:1.3657	Wed Mar  2 10:51:58 2005
+++ kaffe/ChangeLog	Wed Mar  2 22:14:32 2005
@@ -2,6 +2,16 @@
 
 	Resynced with GNU Classpath.
 
+	2005-02-26  Roman Kennke  <roman at ontographics.com>
+
+        * javax/swing/plaf/basic/BasicListUI
+        (updateLayoutState,paint): make BasicListUI aware of the
+        width of the rendered JList
+
+2005-03-02  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-02-25  Sven de Marothy  <sven at physto.se>
 
         * java/net/InetAddress.java
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.4 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.5
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java:1.4	Sun Oct 24 13:39:19 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicListUI.java	Wed Mar  2 22:14:34 2005
@@ -44,6 +44,9 @@
 import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 import java.awt.event.MouseEvent;
@@ -71,6 +74,22 @@
  */
 public class BasicListUI extends ListUI
 {
+
+  /**
+   * A helper class which listens for {@link ComponentEvent}s from
+   * the JList.
+   */
+  class ComponentHandler extends ComponentAdapter {
+
+    /**
+     * Called when the component is hidden. Invalidates the internal
+     * layout.
+     */
+    public void componentResized(ComponentEvent ev) {
+      BasicListUI.this.damageLayout();
+    }
+  }
+
   /**
    * A helper class which listens for {@link FocusEvents}
    * from the JList.
@@ -296,6 +315,10 @@
   /** The property change listener listening to the list. */
   PropertyChangeHandler propertyChangeListener;
 
+  /** The component listener that receives notification for resizing the
+   * JList component.*/
+  ComponentListener componentListener;
+
   /** Saved reference to the list this UI was created for. */
   JList list;
 
@@ -437,6 +460,7 @@
             Dimension dim = flyweight.getPreferredSize();
             cellHeights[i] = dim.height;
             cellWidth = Math.max(cellWidth, dim.width);
+            cellWidth = Math.max(cellWidth, list.getSize().width);
           }
       }
     else
@@ -481,6 +505,7 @@
     listSelectionListener = new ListSelectionHandler();
     mouseInputListener = new MouseInputHandler();
     propertyChangeListener = new PropertyChangeHandler();
+    componentListener = new ComponentHandler();
     updateLayoutStateNeeded = 1;
   }
 
@@ -527,6 +552,7 @@
     list.addMouseListener(mouseInputListener);
     list.addMouseMotionListener(mouseInputListener);
     list.addPropertyChangeListener(propertyChangeListener);
+    list.addComponentListener(componentListener);
   }
 
   /**




More information about the kaffe mailing list