Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Linking column resizing in two JTables  RSS feed

Victor Roberto Cardona
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I am trying to display totals for data contained in a JTable. In order to display the totals, I have a second JTable right underneath the first. Both tables have their own table models. The first table uses an instance of DefaultTableColumnModel, while the second table uses a custom TableColumnModel that also happens to implement TableColumnModelListener.

This setup has allowed me to separate the totals row from the data table and made sorting easier. It also allows me to handle the reordering of columns. I can't figure out how to handle column resizes though. I want to be able to automatically resize the columns in the second table to match the size of the columns in the first table. I am not even sure what events I should be trying to listen for. Can anyone offer any suggestions?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!