Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2005

Tip: Looking for answers? Try searching our database.

Trouble with layout managers and JPanels

Thread view: 
E-Male - 10 Oct 2005 20:50 GMT
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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.