• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make Jtable Cells non Editable

 
Chandu onwards
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make JTable Cells non Editable.
I'm pretty new to new GUI coding, plse help me!!
Thanks,
chandu.
 
Chandu onwards
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i could get the answer from this URL
http://www.coderanch.com/t/330120/GUI/java/make-JTable-as-Non-Editable
 
Mudunuri Raju
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this code. It means the 1st column in the JTable is editable(true). All other all non editable(false). If you want all are non editable
simply return false. Hope you understand this now.
public boolean isCellEditable(int row, int col) {
if (col == 0) {
return true;
} else {
return false;
}
}
 
Jawad Kakar
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is how I did, I made the first col editable and rest not editable. I have a checkbox and a text field in first col. for booking flight(s).
Thank you
Jawad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic