简体   繁体   中英

How to ignore a column of a TableModel in a JTable?

I have a TableModel to a JTable and I must put it on another table, and I've done it just seting the model of the second table with setModel(firstTableModel) .

The problem is that I don't want that one of the columns of the model shows on the second table.

Is it possible to ignore/not display a single column, or I really must create another TableModel with all the redundant information of the first table model to omit just a single column?

感谢@mKorbel,我找到了解决方案:

secondTable.removeColumn(secondTable.getColumnModel().getColumn(columnIndex));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM