Reputation: 3150
How to set columnWidth and rowHeight in GridBagLayout? Is it gridWidth and gridHeight?
How this column Widths can be specified dyanmically?
Upvotes: 3
Views: 14535
Reputation: 4847
You cannot specify the width
and height
of a cell in GridBagLayout; if that is what you are looking to do. Th layout manager calculates row height based on all components in the row.
You can check this Oracle tutorial on GridBagLayout
Added Based on the screen shot you added seems you are using some tool like JFormDesigner. It is a customised layout, column width and column height does not come in standard GridBagLayout.
Upvotes: 3
Reputation: 347184
According to the JavaDocs
gridheight
Specifies the number of cells in a column for the component's display area. Use REMAINDER to specify that the component's display area will be from gridy to the last cell in the column. Use RELATIVE to specify that the component's display area will be from gridy to the next to the last one in its column.
gridheight should be a non-negative value and the default value is 1.
gridwidth
Specifies the number of cells in a row for the component's display area. Use REMAINDER to specify that the component's display area will be from gridx to the last cell in the row. Use RELATIVE to specify that the component's display area will be from gridx to the next to the last one in its row.
gridwidth should be non-negative and the default value is 1.
So, if you want to specify the number of rows or columns a component will span, then, yes
Upvotes: 4