This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

make cells in JTable uneditable

 
john latham
Greenhorn
Posts: 22
  • 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
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for that, works good
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic