Skip to main content

table cell width

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
4 replies [Last post]
404_not_found
Offline
Joined: 2010-11-25

Hello! How to set a fixed width of the cell in the table?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07

You can only set width in percentages, you need to override createCellConstraint and return a width constraint.

404_not_found
Offline
Joined: 2010-11-25

and how to do this?

vprise
Offline
Joined: 2003-11-07

I thought that was pretty explicit... You need to inherit the table and just override that method

</p>
<p>    protected TableLayout.Constraint createCellConstraint(Object value, int row, int column) {</p>
<p>           TableLayout.Constraint c = super.createCellConstraint(value,  row,  column);</p>
<p>           c.setWidthPercentage(val);</p>
<p>           return c;</p>
<p>    }</p>
<p>

404_not_found
Offline
Joined: 2010-11-25

Thank you very much!