Help w/adding a TableColumn
asd_at_asd.com
Date: 04/28/04
- Next message: Tom St Denis: "Re: Cracking DES with C++ is faster than Java?"
- Previous message: Julie: "Re: Cracking DES with C++ is faster than Java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Apr 2004 15:27:07 GMT
I need to modify any given column's header in my JTable. I couldn't
find a way of doing this, so I attempted to remove the necessary
TableColumn and re-add a TableColumn into the same position. The
problem I'm having is that it adds the TableColumn to the end of the
JTable, even when I set the appropriate index in the TableColumn
constructor. I've tried adding the TableColumn to the JTable and its
DefaultTableModel, neither works.
Here is the code I'm using:
TableColumn newCol = new TableColumn(index);
newCol.setHeaderValue(new String("New"));
TableColumn oldCol =
tblDecisionMatrix.getColumnModel().getColumn(index);
//tblDecisionMatrix.removeColumn(oldCol);
//tblDecisionMatrix.addColumn(newCol);
TableColumnModel colMdl = tblDecisionMatrix.getColumnModel();
colMdl.removeColumn(oldCol);
colMdl.addColumn(newCol);
Any help would be much appreciated. Please email replies to
tdk13@perfectsolve.com
Thanks,
Tamir
- Next message: Tom St Denis: "Re: Cracking DES with C++ is faster than Java?"
- Previous message: Julie: "Re: Cracking DES with C++ is faster than Java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|