Hey there,
I am aware of GridLayout, BorderLayout and FlowLayout classes. However, I find them not to work satisfactorily well for me when trying to layout the entire content in a frame.

What I usually do is this:

I identify parts that I want in my window. For each part, I build a panel that holds what buttons, input, and other controls I deem needed. I then put these panels on my frame, where I use a grid layout with one column and a suitable number of rows. Basically, after laying out panels using GridLayout, BorderLayout, and FlowLayot, I put them one after one in a horizontal order on my frame.

I was wondering if someone more experienced could give me some insight on whether there is any other, more suitable method to do layouts in Java views.

thank you.

Edited 5 Years Ago by bibiki: n/a

1) nobody told us, that part of JComponents would be added to the COntainer are un-visible and occupated/filled oe create free space,

2) Nested layout (as you described) is best way/logics how to very confortable layout anything

3) combine Border/Grid and nested Containers by GridBagLayout

4) look for MigLayout, but seems to be still to much tricky and buggy

Edited 5 Years Ago by mKorbel: n/a

GridBagLayout is the daddy of them all, but has a steep learning curve and gets quite verbose (thanks to all the options). However, I think it's the ultimate tool in the Swing expert's toolbox, so it's worth the effort.
Having said that, it's often easier just to nest JPanels with an assortment of simple layout managers (border & grid mainly).

Alright,
thank you a lot to both of you.

P.S. JamesCherrill, congratulations for being now part of daniweb's hall of fame.

This question has already been answered. Start a new discussion instead.