• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in JTable Renderer and Editor

 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic