1

Possible Duplicate:
How to keep a single column from being reordered in a JTable?

Using:

getTableHeader().setReorderingAllowed(false);

Will prevent ALL columns from re-ordering. However, I wish to only prevent the first column from being reordered.

After googling this is the closest I have found:

setColumnModel(new DefaultTableColumnModel() {  
    public void moveColumn(int columnIndex, int newIndex) {  
        if (columnIndex == 0 || newIndex == 0) return; // don't allow  
        super.moveColumn(columnIndex, newIndex);  
    }  
});     

However, this causes a strange visual flaw when attempting to drag the first column. Any one has a perfect solution to this problem?

Community
  • 1
  • 1
delita
  • 1,571
  • 1
  • 19
  • 25

0 Answers0