JTable column widths reverting to defaults?
I have a form with 3 JTables on it. The first two are working fine, but the third is resetting to default column widths after the data structure is updated and a fireTableStructureChanged() occurs.
Can anyone tell me what would cause the table to reset to default widths? I'm setting minWidth, maxWidth and preferredWidth (trying to be complete).
I'd like some debug ideas. I'm setting the width values all over the place trying to find why it keeps reverting. I've even tried setting them in a PropertyChangeListener on the minWidth variable.
Any help would be greatly appreciated.
Thanks in advance!
-Will
Re: JTable column widths reverting to defaults?
What layout are you using? What's a form? Better yet: post an SSCCE (not your whole program) demonstrating what's going on, so we can play with it ourselves.
Re: JTable column widths reverting to defaults?
Oops. I meant "Frame", not form. That's what I get for typing too fast.
I will try to get a SSCCE together, but in the mean time do you happen to know what might cause the columns might revert back to default widths?
Re: JTable column widths reverting to defaults?
Okay, I found my problem. For anyone else having this kind of problem. The fireTableStructureChanged() caused the information to be wiped from the columns. Every time I execute this method I have to be sure I go back and setup my columns again.
BUT, it would be easy to do this if I could have a listener that is called when this method is called. Haven't figured this one out yet.