This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes table columns not resizable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "table columns not resizable" Watch "table columns not resizable" New topic
Author

table columns not resizable

Cathy Song
Ranch Hand

Joined: Jul 01, 2003
Posts: 92
Hi All,

I can make an invisible column visible again using the following code. But this newly visible colum is not resizable anymore..I wonder why..

int width = 50;
resultTable.getColumnModel().getColumn(index).setMinWidth(width);
resultTable.getColumnModel().getColumn(index).setMaxWidth(width);
resultTable.getTableHeader().getColumnModel().getColumn(index).setMinWidth(width);
resultTable.getTableHeader().getColumnModel().getColumn(index).setMaxWidth(width);
resultTable.getColumnModel().getColumn(index).setResizable(true);
resultTable.getTableHeader().getColumnModel().getColumn(index).setResizable(true);


Thanks,
Cathy.
Eric Snell
Greenhorn

Joined: Jun 09, 2004
Posts: 28

Because you set the min and max sizes to the same value.

Before you hide your column, save the initial min and max, then when you restore your column reset the min and max to what you save. If you don't want to save the values, try setting min to 0 and max to Integer.MAX_VALUE.

I have a bunch of code for sizing, hiding, restoring, and persisting table column information. If you want I'll email it to you.
Cathy Song
Ranch Hand

Joined: Jul 01, 2003
Posts: 92
Thanks Eric. The problem is fixed.

-Cathy.
[ June 16, 2004: Message edited by: Cathy Song ]
praveen kumar gudapati
Greenhorn

Joined: Sep 26, 2003
Posts: 15
Please email the code to me too
gudapati@tiscali.de
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: table columns not resizable