1

I am new to Java GUI and find a problem about choosing right layout manager to achieve the layout I want. Below is what I get so far and what I want to achieve: enter image description here

enter image description here

enter image description here

And here is what I did: enter image description here

enter image description here

I used BoxLayout in JPanel(1)~(9).

used boxlayout with Y-axis in (1),(2),(3),(6),(7)

used boxlayout with X-axis in (4),(5)

the relation of panels(1)~(9) is :

(4) contains (1),(2),(3).

(7) contains (4) (5) (6).

Hopes someone will kindly give me some advice.Thanks.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
xxx_yyyy
  • 63
  • 1
  • 5
  • I would use gridbaglayout with 5 columns and use multiple columns for different elements. The tables will span columns 1-2 and 4-5. The "Please select one..." part and buttons on bottom would span columns 2-4. I'm not sure what you are using now, but this could be only a problem of anchoring? – NeplatnyUdaj Nov 20 '15 at 14:46
  • 2
    I often use [combinations of layout managers](http://stackoverflow.com/a/5630271/418556) rather than try to find the perfect 'one' layout manager.. – Andrew Thompson Nov 20 '15 at 14:49
  • 1
    Also it's handy to use layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556).. – Andrew Thompson Nov 20 '15 at 14:50
  • 2
    What is the layout of 7? Try `BorderLayout`, with 4 in `NORTH`, 5 in `CENTER` and 6 in `SOUTH`. Panel 6 looks more like a `GridLayout(1, 2)`. – trashgod Nov 20 '15 at 17:10

0 Answers0