• Post Reply Bookmark Topic Watch Topic
  • New Topic

Panels with same width  RSS feed

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have some panels and all should have the same width, like the largest panel has. How can i do this?
Thanks!
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GridLayout gives each component in the grid the same width.
http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html
Chantal
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to use gridbaglayout. I have a selfdefined panel, that i use for my panels. I thought it is possible with a static variable, which stores the size of the largest instanze of a panel. other panels should return this variable with getPreferredSize.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can set the gridBagConstraints.ipadx value for the constraints of the panels. then the gridbaglayout will set the width of each panel to this value.
Chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!