Making JTable cells uneditable

后端 未结 4 587
独厮守ぢ
独厮守ぢ 2020-12-19 23:25

I am trying to make all the cells of a JTable uneditable when double clicked by the user. I have read a lot of forum posts and the general consensus is to create a new table

4条回答
  •  余生分开走
    2020-12-19 23:57

    Earlier today I had the same problem. This solved it for me.

        JTable table = new JTable( data, headers ){  
          public boolean isCellEditable(int row, int column){  
            return false;  
          }  
        };  
    

    works great!

提交回复
热议问题