Making JTable respect TableColumn preferredWidths

Hi,

Is there any way of making the JTable always respect the preferredWidths set in the TableColumn of the TableModel.

Upon looking into the Source code of JTable, i found a private method in doLayout called setWidthsFromPreferredWidths which redistributes the columns based on the total JTable width.

One thing I found unusal is that it also updates the original preferred column widths we set in the model.

Thanks,

On Ali

[460 byte] By [on_alia] at [2007-11-26 18:40:26]
# 1
Are you maybe looking for JTable.setAutoResizeMode() ?
JayDSa at 2007-7-9 6:14:28 > top of Java-index,Desktop,Core GUI APIs...
# 2
no. I have set AutoResize OFF. still that method changes the preferred widths. i even looked at the code of that method in doLayout and no where does it check for autoresize mode
on_alia at 2007-7-9 6:14:28 > top of Java-index,Desktop,Core GUI APIs...
# 3

> no. I have set AutoResize OFF. still that method changes the preferred widths.

No it doesn't.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the code retains its original formatting.

camickra at 2007-7-9 6:14:28 > top of Java-index,Desktop,Core GUI APIs...
# 4
Camickar>And don't forget to use the Code Formatting Tags so the code retains its original formatting. please explain this codes for me .for examples what tag of blue colour?
vanpersiea at 2007-7-9 6:14:28 > top of Java-index,Desktop,Core GUI APIs...
# 5
The "link" is created by using the [ url ] tag. Reply to the posting and click on the "Quote Original" button and you will see the exact text that was entered for my response.
camickra at 2007-7-9 6:14:28 > top of Java-index,Desktop,Core GUI APIs...