• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Panels and GridLayouts Question  RSS feed

 
Phong Tran
Greenhorn
Posts: 8
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When creating a GUI with a GridLayout of 3,1 (3 rows and 1 column). I can create a JPanel(1,3) to turn one column into 3.

Now here's my question:

Is there a way to create the opposite. So in a situation where I have a GridLayout of 3,2 (3 rows and 2 columns). Is it possible to create a JPanel or JLabel that is Centered and takes up an entire row and it's two columns?

A way graphically explain my question:
WIth a GridLayout of 3,2
__________________
|________|________|
|________|________|
|________|________|

I want to see if I can merge two columns to make something like this.
__________________
|_________________|
|________|________|
|________|________|

I realize I can make the GridLayout to be 3,1. and have a JPanel for each row... but I'm wondering if there's another way.

Thanks in advance,

Phong Tran
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a word: GridBagLayout
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!