• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Problem in JTable Renderer and Editor

 
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I have created a JTable with one Column have the Custom TableCellRenderer, and TableCellEditor

Which has the a JPanel with one lable and a button.

Problem is:

I have to edit the content of table by clicking the button, i will select some data from another dialog,

if i select that data the cell contenet is not updating, and i can not able to select any other cell in the table.

if i resize the colomn the above problem will solve.

Please help on this to fix
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your table will not display the new data unless you update the model using the appropriate model methods. Are you doing that?
If yes, please post a sscce code which demonstrates your problem.
Note: Please do take out time to visit the link I provided to find out what sscce really means.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Renderer Class

And The Editor Class


Sorry i am not able to copy paste the code because they disabled all those in office.
If you need some more code please tell me i will try to type it
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i did not created any model for that Table
i just created the JTable using JTable(Object[][] data,String[] colNames) Constructor
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read my reply carefully.
I had asked you if you are updating the model with the new values. All you have told me is you had forgotten to create the model and a bunch of code which is not SSCCE.
If you cannot take efforts to help us help you, I do not see what else can be done.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i made some thing wrong,

Can you tell me what al the methods i have to handle in Model class,
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out the default/abstract/table model API. You will notice methods which will insert,delete,update the data

In pseudo code
1) Define a table model
2) Create a table using that model
3) When you want to modify the table data, modify the table model
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Maneesh

I fixed the issue, but still repaint is not happening. But i can select any cell for editting the cell.

The Solution is to make the stopCellEditing() method should return true;


 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maneeh
For the repainting the JTable:
The issue was i have to call fireEdittingStopped(); in th Editor after closing the dialog

Its working fine now, Thanks for your support.
reply
    Bookmark Topic Watch Topic
  • New Topic