Set all JTable cells unselectable

前端 未结 1 843
灰色年华
灰色年华 2021-01-04 12:47

I\'m trying to create a JTable that simply displays data and does not allow any edits or selections. I set all cells to be uneditable by running:

TableModel         


        
相关标签:
1条回答
  • 2021-01-04 13:32

    In addition to returning false from isCellEditable(), add these invocations.

    table.setFocusable(false);
    table.setRowSelectionAllowed(false);
    
    0 讨论(0)
提交回复
热议问题