• Post Reply Bookmark Topic Watch Topic
  • New Topic

Disabling a cell

 
Hlumela Bongobi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me, i know how to disable an entire column but how can i disable a single cell. My class does not extend JTable.
Your reply will be highly appreciated.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TableModel has a method called isCellEditable(int row, int column). With this method, you can specify for each cell whether or not it should be editable.

Usually you only check on complete columns:

You can of course use the row value as well:

Of course, a combination can be used as well. In fact, you can put any code in there. Just create a subclass of DefaultTableModel (either anonymously or named) and override this method only.
 
Hlumela Bongobi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much, it works!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!