This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Layout manager question

 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do CardLayout and GridBagLayout managers
honor components' preferred sizes? Thanks.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the API:
GridBagLayout:
...In addition to its constraints object, the GridBagLayout also considers each component's minimum and preferred sizes in order to
determine a component's size.

In addition I'd say that GridBagLayout honors the components preferred size as long as you don't use constraints which tell the layout manager to do otherwise (like the GridBadConstraints.fill member)
From the API:
CardLayout method layoutContainer:
Each component in the parent container is reshaped to be the size of the container, minus space for surrounding insets, horizontal gaps, and vertical gaps.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic