• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Grid Layout Problems

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also Google for MigLayout. I have never tried it, but those who have say it's very good.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic