ZIXUAN DING
ZIXUAN DING

Reputation: 1

relationship between default table model and table

I am new to java swing and I am working on build a GUI to display selected columns of data from a data frame.

When a column name is selected, I added the data and the column header by DefaultTableModel since DefaultTableModel is always applied to JTable.

When a column name is deselected, the column of data should be removed from JTable and there's a method called "removeColumn", which could only remove the "view" -- the data still stays in the DefaultTableModel.

When the same column name is selected again, how can I display the column again without adding it again into the DefaultTableModel ?

Or, is it possible to build the full table(with all the columns) in DefaultTableModel, and only add part of them to the JTable for display (or not display) ?

I can't find a way to add values into a DefaultTableColumnModel..

Upvotes: 0

Views: 514

Answers (0)

Related Questions