Hi.,
I am using a JTable with AbstractTableModel.,
on right of a table header i am removing the selected columns .,
columns are removed from the column model., but the gap that column occupied
is left blank inspite of
calling auto resize all columns., and repainting table header.,
if i drag the header then it will resize all columns.,.,
i don't want to that .,
is there any work around for this.,
i want to fill the gap with all other columns adjusted to fit the
JScrollPane.,.,
without dragging the header.,.,,.,after removing the columns.,
Thanks in Advance
panyam
----- Original Message -----
From: Bill Tschumy <[EMAIL PROTECTED]>
To: Christian Pesch <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, April 25, 2001 07:01 PM
Subject: Re: Help with JTable column width
No, that doesn't help but thanks for the suggestion. I have found a
partial solution, but I don't know why my original method fails.
When I would change the host status I need to update the icon in
column 0. To do so I used the following code.
public void statusChanged(RemoteHost host)
{
tableModel.fireTableRowsUpdated(hosts.indexOf(host),
hosts.indexOf(host));
}
The call to fireTableRowsUpdated() is what messes up the column
widths. If I change this to a simple repaint() on the JTable the new
status is correctly displayed. Of course, listeners are not
notified, but I can handle that in other ways.
Isn't it the case that I should call fireTableRowsUpdated() when I
know the TableModel has new data to display?
At 9:06 AM +0000 4/25/01, Christian Pesch wrote:
>Bill Tschumy schrieb:
>
>> Why is the table allocating so much space to the column?
>
>How about trying to set the second column to be resizable?
>
>> column = getColumnModel().getColumn(0);
>> column.setPreferredWidth(20);
>> column.setMinWidth(20);
>> column.setMaxWidth(20);
>> column.setResizable(false);
>>
>> column = getColumnModel().getColumn(1);
>> column.setResizable(false);
>
>Set this to true. This might solve your resize problems,
>since for now the JTable has the problem, that according
>to the ColumnModel it is not allowed to resize but the container
>of the JTable donates it more spaces. Thus the JTable streches
>the columns on its own.
>
>--
>Christian Pesch - Software Engineer
>[EMAIL PROTECTED] - fon +49.40.325587.505 fax .999
>CoreMedia AG - www.coremedia.com - 0700-COREMEDIA
>Erste Brunnenstra�e 1, 20459 Hamburg, Germany
>
>CoreMedia - Think ahead! We're there.
--
Bill Tschumy
Otherwise -- Austin, TX
[EMAIL PROTECTED]
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing