wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes how to add Columns dynamically to JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to add Columns dynamically to JTable" Watch "how to add Columns dynamically to JTable" New topic
Author

how to add Columns dynamically to JTable

Vasu Reddy
Ranch Hand

Joined: Sep 13, 2005
Posts: 32
Hi,

I need some idea to add number of columns dynamically.

My application gets data by querying, the no of columns per query are not same. Some results need 5 columns, and other needs 12,....

How to add number of columns to ColumnHeader dynamically.

Thanks in advance,

Regards,
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Are your queries so similar that it's just a matter of adding columns? I would have expected that you would have to create a new TableModel as the result of a different query, at the very least. Then perhaps some tweaking of renderers, editors and Column settings...


There is no emoticon for what I am feeling!
Vasu Reddy
Ranch Hand

Joined: Sep 13, 2005
Posts: 32
Hi Jeff,

Yes you are right, and thanks for your idea. I will try this way.

Thank you,

Vasu Reddy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to add Columns dynamically to JTable