Hi everybody,
I'm trying to create my own component, made up with 2 different panels
inside one outer panel. Of these two inner panels one is narrow and
long, with fixed height. The other one can be stretched in any way. I'd
like them to show like this
-----------------------
|---------------------|
|| Inner JPanel 1 || <-- Outer JPanel
|---------------------|
|---------------------|
|| Inner JPanel 2 ||
|| ||
|| ||
|| ||
|---------------------|
-----------------------
I first tried setting the layout manager of the outer panel to BoxLayout
and putting the first on NORTH and the second on CENTER. I tried to set
the minimum, maximum and preferred size to my desidered height but it
still got the whole size. Then I changed layout manager and tried with
GridBagLayout but the outcome was the same!!!
To be precise, the JPanel 2 should be inside a JScrollPane but I haven't
tried yet? Will it change the outcome again?
Thank you
E-Male
Vova Reznik - 10 Oct 2005 20:57 GMT
> Hi everybody,
>
[quoted text clipped - 17 lines]
> I first tried setting the layout manager of the outer panel to BoxLayout
> and putting the first on NORTH and the second on CENTER. I tried to set
Did you mean BorderLayout?
> the minimum, maximum and preferred size to my desidered height but it
> still got the whole size. Then I changed layout manager and tried with
[quoted text clipped - 5 lines]
> Thank you
> E-Male
http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
E-Male - 10 Oct 2005 21:56 GMT
> Did you mean BorderLayout?
Ops, sorry. Of course I meant BorderLayout :)
> http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html
I had already read all that stuff, besides a book about Swing etc., and
I really felt I was doing all right! I had read it all again and again
and I was sure it was right but... then I realized that in preferred
size I had switched height and width :(
Sorry and thank you anyway
E-Male
Roedy Green - 10 Oct 2005 21:45 GMT
> I'm trying to create my own component, made up with 2 different panels
>inside one outer panel.
A JSplitPane might do what you want rather than fooling around with
BorderLayout.
see http://mindprod.com/jgloss/jsplitpane.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
E-Male - 10 Oct 2005 23:46 GMT
> A JSplitPane might do what you want rather than fooling around with
> BorderLayout.
>
> see http://mindprod.com/jgloss/jsplitpane.html
Thank you very much for the suggestion but I wanted the upper panel not
to be resizable. Anyway I ended up realizing what my mistake was and
solved it.
Thank you
E-Male
Monique Y. Mudama - 12 Oct 2005 23:56 GMT
>> A JSplitPane might do what you want rather than fooling around with
>> BorderLayout.
[quoted text clipped - 4 lines]
> not to be resizable. Anyway I ended up realizing what my mistake was
> and solved it.
What was your mistake?

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html