Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Gridbag layout

 
Tien Shan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • 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.
//--

 
Haina Minawa
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic