• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Gridbag layout

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have butons, combo boxes, etc, that I want to put in 3X3 row and column.
I used gridbag layout and they distributed themselves sparsely, and the two columns on the right and on the left are uncomfortable close to the panel boarder. I want to put some space between the 1st and the 3rd row and the edge of the panel.
In other words, I want to put them closer to the 2nd row in the center. I tested weightx property, but did not get it as per my wish.

If you have any tips, please let me know. Thank you.
 
Tien Shan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry - I should have taken time to read before posting.

/--
I want to put buttons, combo boxes, etc, in 3X3 row and column, at the center of a panel but still with some distance from the middle row/column item, with some space around the outermost items.

I used gridbaglayout and the buttons, etc. distributed themselves sparsely; the two columns on the right and on the left are uncomfortably close to the panel border. I want to put some space between the 1st and the 3rd column and the edge of the panel.
In other words, I want to put them closer to the 2nd column in the center. I tried weightx property, but did not get it as per my wish.

If you have any tips, please let me know. Thank you.
//--

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tien Shan wrote:I have butons, combo boxes, etc, that I want to put in 3X3 row and column.
I used gridbag layout and they distributed themselves sparsely, and the two columns on the right and on the left are uncomfortable close to the panel boarder. I want to put some space between the 1st and the 3rd row and the edge of the panel.
In other words, I want to put them closer to the 2nd row in the center. I tested weightx property, but did not get it as per my wish.

If you have any tips, please let me know. Thank you.



use an inset (it is something like padding)

constraints.insets = new Insets(10, 50, 10, 50);
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic