Disable single column drag & drop in JTable

How to disconnect only one column from drag and drop in JTable? I want other columns to be dragged, but only the first column (with index 0). Thank.

+3
java user-interface swing jtable
Jan 20
source share
2 answers

You must create your own TableColumnModel (extend DefaultTableColumnModel ) and override moveColumn to only call super.moveColumn when the column is allowed to drag.

EDIT : Check out this post first .

+5
Jan 20 '10 at 19:20
source share

Not really for you .... found in another blog

 yourJTable.getTableHeader().setReorderingAllowed(false) 

this will cause the whole table to not reorder the columns that I need. The source route is the correct route.

+3
Apr 22 '14 at 2:56
source share



All Articles