Yasson
August 29th, 2002, 03:49 PM
Hi all.
I'd like to ask you how I can make the wigth of each column in my JTable equals to the width of maximum element in it?
Thanks in advace.
btheg
August 30th, 2002, 06:26 AM
hi,
you can get the width of your component by:
int width = someComponent.getWidth();
in the JTable you can set the max, min and preferred Width with
table.getColumn("columnname").setMinWidth(width)
.setMaxWidth(width)
.setPreferredWidth(width)
hope it will help you
BtheG
Yasson
August 30th, 2002, 04:37 PM
I did it usind the following:
for(int i = o; i<colNamrs; i++)
{
getColumnModel().getColumn(i).setPreferredWidth(myInt);
}
Thanks for all advices!!!
Yasson