开发者

Disable a single column dragging in JTable

开发者 https://www.devze.com 2022-12-17 19:48 出处:网络
How should I disable just a single column from dragging in JTable? I want to allow other columns from dragging but just the first column (indexed at 0). Th开发者_JAVA百科anks.You should be able to cre

How should I disable just a single column from dragging in JTable? I want to allow other columns from dragging but just the first column (indexed at 0). Th开发者_JAVA百科anks.


You should be able to create your own TableColumnModel (extend DefaultTableColumnModel) and to override moveColumn to only call super.moveColumn when the column is allowed to be dragged.

EDIT: Have a look at this post first.


Not quite on point for you ....found on another blog

yourJTable.getTableHeader().setReorderingAllowed(false)

this gets the entire table not to reorder columns which is what I needed. Exploring the Override is the correct route

0

精彩评论

暂无评论...
验证码 换一张
取 消