Article View: borland.public.jbuilder.java.swing
Article #7880Re: FlowLayout and JScrollPane
From: Thomas G�lden (p)
Date: Tue, 05 Dec 2000 00:00
Date: Tue, 05 Dec 2000 00:00
70 lines
3676 bytes
3676 bytes
Hi John, I use the JScrollPane component. As to the thumbnail display, I currently develop my own little JPanel and controler class to create and display thumbnails. The application is a client to an Oracle 8i database where for each dataset a normal image and a small thumbnail image is stored. Depending which tabpane the user has selected, he will see a large image of a selected dataset or an array of thumbnails representing a certain section of the data. I think I can resolve the problems with the thumbnails, but hoped that Flow Layout could make the implementation of the display a little easier. Actually to me the logic, implemented in the JScrollPane is not very straightforward. If I set the horizontal scrollbar property to NEVER, I'd except that the scrollpane / viewport would *not* allow its child to have any size it desires. At least there should be a possibility to control this behaviour. But this is probably a request, which should be directed to the Swing developers. Anyway I would appreciate, if you could send me your code regarding the Flow Layout, as you mentioned. Thanks and regards Thomas Thomas.Guelden@t-online.de "John McGrath [TeamB]" <ng-b@JPMcGrath.net> schrieb im Newsbeitrag news:MPG.149685b74a9e9bc4989d95@forums.borland.com... > On Sun, 3 Dec 2000 15:22:19 +0100, "Thomas G�lden \(p\)" > <Thomas.Guelden@t-online.de> wrote: > > > I try to develop an image browser, where thumbnails of images > > are put in rows. So to use the FlowLayout as the layout for my > > panel seems to be the right choice, because it puts components > > in a new row when one row is full, depending on the width of > > the panel. However, when the rows extend the height of my panel > > I would like to show a scrollbar on the right of the panel. > > This is a problem I have dealt with on a number of occasions. I have > some example code at the office that I can post for you, but I do not > have it right now. I will try to get to it tomorrow. Actually, I have > a program that displays image thumbnails exactly as you describe, but > alas, I cannot post that. > > Question: Are you using an AWT ScrollPane or a Swing JScrollPane? > > Here is a brief description of the problem: > > When asked for the preferred size of a container, a FlowLayout will > return a size that assumes its children will be laid out in a single > row. This is because there is no mechanism to tell the child the > maximum width available. > > When a ScrollPane or the JViewport of a JScrollPane is laid out, it > gives the child component any size it desires. After all, that is what > the scroller is supposed to do. So the scroller gives the child > component exactly the size it asks for, and the child is laid out in a > single row. > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<90j8re$3dp4@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<90dkq2$fr4@bornews.inprise.com> <MPG.149685b74a9e9bc4989d95@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,282a839afa7c07f X-Google-Attributes: gid111d45,public From: "Thomas G�lden \(p\)" <Thomas.Guelden@t-online.de> Subject: Re: FlowLayout and JScrollPane Date: 2000/12/05 Message-ID: <90j8re$3dp4@bornews.inprise.com> X-Deja-AN: 701428404 References: <90dkq2$fr4@bornews.inprise.com> <MPG.149685b74a9e9bc4989d95@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Organization: Bayerisches Geologisches Landesamt X-MSMail-Priority: Normal Reply-To: "Thomas G�lden \(p\)" <Thomas.Guelden@t-online.de> Newsgroups: borland.public.jbuilder.java.swing