Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

editing a cell in a uneditable model of JTable

 
lavanya subramanian
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
i have a JTable which is uneditable that is,i had overriden the isCellEditable method.but the question is ,if i press a button i should be able to insert a new row in that table.
is it possible.

thanks in advance
lavanya
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes but you won't be able to change the values.
 
Jeff Wisard
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, you can change any value at any time in the model programmatically by using the setValueAt() method. The isCellEditable() method only determines whether or not a cell value is changeable by a USER...that is, someone clicking or tabbing into the cell.
This is true for adding, updating, or removing row or cell data.
 
lavanya subramanian
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
sorry for not explaining my problem clearly,
actually when i press the button,i want a empty cell in the JTable and i want only that cell to be editable,so that i can write a value there.
is it possible,if so how?.
thanks,
lavanya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic