This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to add Columns dynamically to JTable

 
Vasu Reddy
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Vasu Reddy
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff,

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

Thank you,

Vasu Reddy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic