Java GroupLayout Implementation

77 views Asked by At

I have a JScrollPane which contains buttons.I need two group of buttons like this.

*-----------------------------------------------*
| Button 1     |   Button 4                     |
| Button 2     |   Button 5                     |
| Button 3     |   Button 6                     |
*-----------------------------------------------*

How can i implement this layout?I am newbie at Java.swing.

1

There are 1 answers

1
Hovercraft Full Of Eels On BEST ANSWER

Why not simply use a GridLayout? i.e., new GridLayout(3, 2) for 3 rows and 2 columns.

Note, that you would have to add the buttons in this order for it to have your desired orientation button 1, button 4, button 2, button 5, button 3, button 6.

For more on this layout, please check out the GridLayout Tutorial and the GridLayout API