• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable Help

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 99
Android Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic