-
November 15th, 2017, 05:34 PM
#1
How to reinsert deleted columns in a Jtable
The code I am using states index out of bounds
The code I am using is
Code:
void Insert(int index)
{table.moveColumn(table.getColumnCount()-1,index);}
Help
-
November 30th, 2017, 02:19 AM
#2
Re: How to reinsert deleted columns in a Jtable
The DefaultTableModel supports a setColumnCount() method which effectively will allow you to remove columns from the end of the model only.
If you want to remove columns from the middle of the model, then you will need to:
1. extend the DefaultTableModel and create your own removeColumn(int column) method.
2. This method would need to loop through every row in the Vector and use the Vector.remove(int) method to remove the column for ever row.
3. Finally once this is done you would need to invoke the fireTableStructureChanged() method to tell the table that a column has been removed so the table can be repainted.
-
December 17th, 2017, 07:38 PM
#3
Re: How to reinsert deleted columns in a Jtable
Thanks. I solved this problem
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|