• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JTable problem

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,
i have implemented a class extending abstract table model and that class is displaying tha data from the resultset through a table .
how can i edit the table cell , so that new value takes place of old value in the cell
can u help me in this?
thanks
abki
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In the class that you extend from AbstractTableModel, you must override two methods:
isCellEditable must return true for all cells which you want should be editable. If you want that all cells should be editable just do:

This will allow users to edit values in the table.
Now, to capture what value the user has passed, you have to override the setValueAt method. This method will be called when the user has finished editing a cell. The new value is passed as the first parameter. With this new value, you must do whatever it takes to make sure that a subsequent call to getValueAt on the same cell returns the new value (if the new value is acceptable).
I am sure you will be able to find examples of what you are trying to do somewhere in this forum.
Hope this helps,
Abhik.
[ July 04, 2003: Message edited by: Abhik Sarkar ]
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic