• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to change size of cells in GridLayout ??  RSS feed

 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i change the size of cells in GridLayout, and also how to make some components span several rows & columns?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't change the size of individual cells - they're all the same with GridLayout.

Components can't span rows or columns with GridLayout, but GridBagLayout can do this (and is significantly harder to use).
 
Scott Florez
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While you can't make components span multiple rows with GridLayout, you can resize them all uniformly. Put your GridLayout on its own JPanel, and then you can use panel.setSize(x,y) to change the panel size and thus increase or decrease the size of the cells.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!