• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagLayout padding question

 
Eoin Mac Aoidh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive got three panels, each one inside of the next.
The second one fits snugly into the first, with no border around the edge,
but the third does not fit into the third so smoothly - there is a big blank box in the middle of it. Im not doing anything differently when putting the third into the second than I am when I put the second into the first.
-Is there a problem with placing so many panels inside of each other using GBL.
Or do I need to change the padding or insets values?
This is really puzzeling to me.
Any help greatly appreciated.
Thanks,

Eoin.
 
Al Hollis
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try changing the ipady and ipadx values to the size of the space you have left available before placing in the third box

c.ipady = value;
c.ipadx = value;
[ May 17, 2006: Message edited by: Al Hollis ]
 
Martin Simons
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GridBagLayout will cause an element to use only as much space as it actually
needs and will center that element in its allotted space, unless the
GridBagConstraints weightx, weighty, anchor, and fill parameters are set to
indicate a different behavior. Check into these four parameters of
GridBagConstraints to fix your problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!