Java Question

Layout for two JLists separated by a "middle" panel? (Java Swing)

I am using BoxLayout to layout 3 components in a row horizontally - two JLists (J1 and J2) and a JPanel in between (X).

---------------
| |
| |
| J1 X J2 |
| |
| |
---------------


The problem I am having is that BoxLayout is making each column equal size, but what I want is for X to be its smallest size and J1 and J2 to take up all the available horizontal space. How can I do this? Basically, the look I am going for is something like this.

enter image description here

Answer Source

I would use a GridBagLayout.

The center buttons would be contained in a JPanel.

The JList, button JPanel, and JList would be contained in 1 row with 3 elements across the row.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download