• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

How to create empty but filled up cells in GridBagLayout  RSS feed

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i want two label to be positioned as in a panel that's next to it and i want label1 to be at position gridx = 0; gridy = 0; and label2 to be in position gridx = 0; gridy = 3; how do i fill up gridy 1 and gridy 2?
Thanks alot!!
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ling,
If you have additional rows with components in those columns, you wouldn't have to do anything special. If however, there isn't anything else in other rows that will create the space you want, you'll need to use some sort of invisible component. javax.swing.Box.createGlue() is most likely what you'll want. You treat it like any other component except that it won't actually show up. It just takes up space. Coupled with GridBagConstraints, it can get your panel looking how you want it.
 
Ling Chung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nice one thanks a lot!!
 
Do not threaten THIS beaver! Not even with this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!