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: Lillian Angel
Subject: Re: [cp-patches] Patch: Scroll pane containing a JList with a preferred size.
Date: Fri, 17 Jun 2005 10:10:25 -0400

On Fri, 2005-06-17 at 12:28 +0200, Roman Kennke wrote:
> 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
> 


I am still working with JScrollPane and the bugs I have encountered.
There possibly is a better solution. Thanks for pointing that out, I
will work on finding a better solution, if possible!

Lillian.





reply via email to

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