Re: Custom JPanels inside another JPanel.



On Tue, 31 Jul 2007 17:55:29 +0000, pek wrote:

So I have this JPanel that I add a scroll pane to make it scrollable. I
created a class that is a subclass of JPanel, lets call it CustomPanel.
CustomPanel basically has some labels, buttons etc. What I do is add a
CustomPanel to the JPanel. What I want is that CustomPanel should have
the width of JPanel but it's own height. That way JPanel ultimately is
contains a list of CustomPanels. What the problem is that I tried to use
BoxLayout and GridLayout. Let's say that JPanel's height is 4 times the
CustomPanel's one. If I add one CustomPanel, that will expand and use
all of JPanels area. If I add more that 5 the CustomPanels are correctly
added with the correct size. So, I can't figure out what Layout Manager
to use.

Any help?
Thank you.

Try a FlowLayout with a vertical direction.
.


Quantcast