tags:

views:

36

answers:

3

I'm new to Java awt, so I am having trouble with setting up panels. I have one giant panel, which needs to hold 3 panels inside (photo is attached at the bottom). One will go on top(1), second one will be in the middle(3), and third goes on the bottom(2). Any remaining space has to be divided equally between (1)/(3) and (3)/(2). Also, the middle panel (3) is a table, so GridLayout has to be used.

How can I achieve this?

Thanks in advance!

P.S. I've tried to draw it in MS Paint (http://i45.tinypic.com/mwejkk.jpg)

+1  A: 

I don't understand all, I suggest :

  • Use swing, not awt, so use JPanel

  • A BorderLayout, with your giant panel (jpanel) in middle, a jpanel at west ; for this jpanel a BorderLayout, or BoxLayout, or GridLayout and put inside your 1 2 3 panels.

... or use netbeans and matisse.

Istao
A: 

This Sun Tutorial shows you how to use the grid layout. Also, your diagram doesn't quite fit the textual description you have.

npinti
Still not sure why it doesn't fit the description, but this helped. Thanks.
Milos
+1  A: 

This will help you a lot. It's a Sun tutorial on BoxLayout. It describes the stacked layout that you appear to need, and also how to make invisible components to add gaps in the extra space you mentioned. For the middle pannel, put a GridLayout in that panel to do the things you need.

Stuart