File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

make cells in JTable uneditable

 
john latham
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do i make cells in my JTable uneditable. The cells that i want to set this way are checkboxes.

What im trying to do is, Only allow for 3 checkboxes max to be selected in my tabel.

And my logic is...if 3 checkboxes have been selected in the table, make all checkboxes that are not checked uneditable ... i tried the following, but it didnt work:



[ September 11, 2006: Message edited by: john latham ]
 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea what that code is supposed to be doing, but it doesn't appear to deal with whether cells can be edited or not. I would do this: override the isCellEditable method of the TableModel. Have it return false if it's referring to an unchecked checkbox and three other checkboxes are checked, and true otherwise.
 
john latham
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for that, works good
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic