|
Rafael procure o tutorial na pagina da
sun.
To customize initial column widths, you can
invoke
setPreferredWidth on each of your table's columns. This sets both the preferred widths of the columns and their approximate relative widths. For example, adding the following code to SimpleTableDemo makes its third column bigger than the other columns:
TableColumn column = null;
for (int i = 0; i < 5; i++) { column = table.getColumnModel().getColumn(i); if (i == 2) { column.setPreferredWidth(100); //sport column is bigger } else { column.setPreferredWidth(50); } } Note: The setPreferredWidth method was first introduced in Swing 1.1 Beta 2. For previous releases, you must use setMinWidth instead, making sure to invoke it on every column. (Otherwise, the columns you miss will be very thin.) Att. Claiton
|
