禁用JTable中的单列拖动 [英] Disable a single column dragging in JTable

查看:49
本文介绍了禁用JTable中的单列拖动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该如何只禁止将单个列拖入JTable中?我想允许其他列拖动,但只允许第一列(索引为0).谢谢.

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). Thanks.

推荐答案

您应该能够创建自己的TableColumnModel(扩展

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.

编辑:看看 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆