File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.
 
jQuery in Action, 2nd edition
 
subject: how to add Columns dynamically to JTable
 
Similar Threads
pictures in a jsp
JTable Columns
Create Dynamic Datatable with sorting functionality
'dynamic' SQL query and 'dynamic' java beans ?
setting the number of columns Dynamically in Grid