• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

no editing for JTables

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i want to know if there is any method where i can avoid the user to change the valued in JTable.
i have a JTable dynamically created after fetching data from database.
but the user can manipulate this data.
i dont want this to happen.
any way??
thanks in advance.
sachin
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the isCellEditable( int row, int col ) method in TableModel... you need to override this to always return false if you don't want the user to edit the table data.
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this. i used it for a project i was working on. call the method from your code.
public boolean isCellEditable(int row, int col)
{
return false;
}
 
    Bookmark Topic Watch Topic
  • New Topic