classpath-patches
[Top][All Lists]
Advanced

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

Re: [cp-patches] Patch: Scroll pane containing a JList with a preferred


From: Roman Kennke
Subject: Re: [cp-patches] Patch: Scroll pane containing a JList with a preferred size.
Date: Fri, 17 Jun 2005 12:28:41 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050317)

Hi Lillian,

Lillian Angel wrote:

I fixed these 2 bugs. Attached is a patch file.

--- javax/swing/JViewport.java  27 May 2005 21:12:46 -0000      1.20
+++ javax/swing/JViewport.java  16 Jun 2005 16:56:53 -0000
@@ -344,6 +344,12 @@
          viewListener = createViewListener();
        v.addComponentListener(viewListener);
        add(v);
+ + Dimension vd = v.getPreferredSize();
+       Object p = getParent();
+       if (p instanceof JScrollPane && !vd.equals( new Dimension() ))
+               ( (JScrollPane) p ).setPreferredSize( vd );
+ fireStateChanged();
      }
  }
I don't think that we should mess with the preferredSize of the parent. Is there no other/better solution to these bugs? I would guess, that it must be something in ViewportLayout, which is responsible for resizing and repositioning the JList (or whatever child). If you think that your solution is correct, then maybe you could write a testcase that shows that the JDK is behaving like this too.

/Roman





reply via email to

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