• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagLayout Question  RSS feed

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using GridBayLayout, and I want to have some blank space at the top of my panel, and an even amount of blank space at the the bottom, with the components in the middle.
Now, I can evenly space the components using weighty=1, or I can bunch them up in the middle using weighty=0, but it's not what I want.
Do I have to make a bogus component or could I just start gridy at a different starting location? (Seems like this might work for the top space, but not the bottom space?)
Thanks,
Drew
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Drew,
it is easier, you have to use the margins of the components to win free space. So maybe to all of your top components, you set the marigin (5,30,0,0), which means to the left component or to the border, there are 5 pixels space and to the top border 30 pixels.
And to your bottom components, you can set something like (5,5,0,30).
Hope that's clear
Rene
 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, you are right.
I just had to set the Insets.
Thanks,
Drew
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!