File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Gridbag layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Gridbag layout" Watch "Gridbag layout" New topic
Author

Gridbag layout

Tien Shan
Ranch Hand

Joined: Oct 08, 2004
Posts: 38
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

Joined: Oct 08, 2004
Posts: 38
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

Joined: Oct 13, 2011
Posts: 119
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);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Gridbag layout