• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to change size of cells in GridLayout ??

 
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: 42970
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.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!