Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable Help  RSS feed

 
Hasnain Javed
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello every one,
This is my first time using a JTable. I have downloaded code for a simple JTable from sun microsystems web site. The code constructs a JTable using the constructor JTable(Object rowdata[][], Object columnNames[]) with a default data model, a default column model, and a default selection model. The problem with this constructor is that the cells are editable. Does any one know how to make the cells uneditable.
Regards.
Hasnain.
 
Suman Mummaneni
Ranch Hand
Posts: 96
Android Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hasnain,

One thing you could do is to set the method in the return false.

This will return false by default. I am not sure what TableModel you are using. Usually you have a class that extends the AbstractTableModel and you pass this object to the JTable constructor.


If you are using for data model then you have to explicitly override the method to return false bcos it returns true for any value of (row,col).Or you could use the for data model if you want the cell to be not editable.

-Cheers,
Suman
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!