# [java] Swing Layout Managers?

## Recommended Posts

Kaze    948
can anyone help me with the swing layouts, Im currently working on a swing control in java, Its calendar like and consists of a class that extends a jpannle that contains other panels to hold title information, a calendar grid and a control at the bottom, Im having trouble formatting it, it needs to be able to resize, I want something like a grid layout except I want the top and bottom to only take about 10% each instead 33% each, I tried the spring layout but it keeps compressing the components it hold to their minimum size while I want them to take up as much room as they can.

##### Share on other sites
Kaze    948
hopefully i can post a screen shot latter

basicy i want

-------------
| top |
-------------
| |
| grid |
| |
-------------
| bottom |
-------------

insted of

-------------
| top |
| |
-------------
| grid |
| |
-------------
| bottom |
| |
-------------

im trying absolute layout but it seems getHeight returns zero until after the componet is added so i cant format it in use the constructor
EDIT: pretened there are spaces to make the edges line up

##### Share on other sites
Do you use:
Main panel (BorderLayout)--------------------------------------| Top (JPanel (FlowLayout?))         ||------------------------------------||                                    ||                                    ||                                    ||                                    || Middle (JPanel(GridLayout))        ||                                    ||                                    ||                                    ||                                    ||                                    ||                                    ||------------------------------------|| Bottom (JPanel (FlowLayout?))      |--------------------------------------

Do you have 1 main panel with three panels in it: one North, one South and one Center?

##### Share on other sites
Kaze    948
ok, thanks
using the BorderLayout worked