• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

GridBagLayout padding question

 
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.
 
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 ]
 
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.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic