• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBag layout  RSS feed

 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, can you tell me why the components appear in the center if you don't specify the weightx and weighty. i might be wrong. but i am experiencing it.
tanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API docs for GridBagConstraints explain this. For example, under weightx -

If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.
The default value of this field is 0. weightx should be a non-negative value.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!