JTable, disable user column dragging

前端 未结 2 557
名媛妹妹
名媛妹妹 2021-01-31 00:57

I have declared my JTable as:

data_table = new JTable(info, header) {
    @Override
    public boolean isCellEditable(int row, int column) {
                


        
相关标签:
2条回答
  • 2021-01-31 01:40

    data_table.getTableHeader().setReorderingAllowed(false); should do the job, unless you mean that the user can resize column headers.

    0 讨论(0)
  • 2021-01-31 01:46

    To anyone having this problem using Netbeans IDE you can disable the user from dragging columns in the JTable by doing the following steps.

    • Right click the table
    • Select Table contents
    • Click the columns tab
    • Uncheck the Allow to reorder columns by drag and drop
    0 讨论(0)
提交回复
热议问题