Till now you have got the edit facilities in all JTable in every previous sections but now you will learn a JTable program in which editing facility is not available. This section tells you, how to disable the user edits in a JTable component means editing is not allow to user. User can't edit any cell of JTable according to his/her own requirements.
Description of program:
This program helps you in how to disable user edits in a JTable components. For this, first of all, you have to create a table having some data and column with column header. Here the isCellEditable() method is used to make allows you for editing or not editing. If this method returns true, you will be able to edit in the JTable and if it returns false, there will be no editing in any cell of JTable. Try it.
Description of code:
This method returns either 'true' or 'false' . If it will return 'true' , the cell of JTable is editable otherwise not.
Here is the code of program:
Output of program:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: April 14, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles