Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable prevent editing

 
fadi mujahid
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
When I double click on a cell in my table, I can edit the data of that cell. Is there a way to prevent this?
Thanks
 
Mag Hoehme
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
yes, you can prevent the editing.
The TableModel interface declares a method "public boolean isCellEditable (int row, int col)". You can implement this method, and let it always return false:

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic