开发者

Help with setting up panels in Java

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开发者_StackOverflow 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)


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜