Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Some More GridBagLayout Help!

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't get the controls to fill out properly. This is what Im going for...



for some reason it fills the controls out as if there were only 3 columns? I don't understand. Even when I make the label occupy col 1 and 2 it does the same thing. AAm I missing something here?



[ September 08, 2005: Message edited by: Shawn Rieger ]

[ September 08, 2005: Message edited by: Shawn Rieger ]

[ September 08, 2005: Message edited by: Shawn Rieger ]
[ September 08, 2005: Message edited by: Shawn Rieger ]
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are adding three components so you will get three apparent columns showing. If you are
going to add components in all five columns somewhere in rows that follow, ie, if there will
be at least one component in each of the "5" columns somewhere in the layout, then
GridBagLayout will size the columns to show the components at their preferred size plus any
additional space as allocated by the judicious use of the weight constraints. If you must
fill out the first row with 5 columns you can add blank labels with or without setting their
preferred size. You might try adding all the components to the layout and then make
adjustemnts as you feel your way toward success. If you want all the cells to be equal width
you might consider using GridLayout for some (each row) or all of the layout.
 
Shawn Rieger
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but with GridLayout I can't strech coponent across 2 or more cells can I?
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure you can. I added your btnInsert button and made it 4 wide on the next row.

Is that what you were looking for?

Steve
[Edit} Sorry I miss read your question. Just ignore this.


[ September 09, 2005: Message edited by: Stephen Boston ]
 
Grow your own food... or this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic