• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Grid Layout Problems

 
Brian Batson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy!

I am using a GridLayout to display a variety of information. It's working just fine but I really wish I could set the width of the columns (like a JTable) for the columns within the GridLayout.

See the attached screen shot for a sample (assume the JLabels are different from the first and second columns).

As you can see, the GridLayout evenly spaces the columns, although I would prefer for the columns holding the JLabels to be much smaller than the size for the columns holding the JTextFields.

Any guidance that you can provide is very much appreciated.
grid_layout_sample.jpg
[Thumbnail for grid_layout_sample.jpg]
 
Rob Camick
Ranch Hand
Posts: 2613
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A GridLayout won't do what you want.

Read up on Layout Managers. A SpringLayout or GridBagLayout would be your best bet.
 
Brian Batson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome, thanks, Rob. Somehow I missed SpringLayout in my initial cursory review of available layouts. The SpringForm mentioned about 3/4 down the following webpage addresses my needs completely: http://download.oracle.com/javase/tutorial/uiswing/layout/spring.html

Thanks, again.

-Brian
 
Campbell Ritchie
Sheriff
Pie
Posts: 49823
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also Google for MigLayout. I have never tried it, but those who have say it's very good.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic