• 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 is not getting updated

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I am having a peculiar Issue in JTable.
I am using JTabbedPanes : In one Pane I can TextFields where I can Add User IDs and in the next Tab I have a JTable which shows list of users who have access(basically if I add in the Textfield any User ID that is saving in the Database and then I am updating the JTable).

But the problem is that the JTable is not getting updated.
I had checked and found that the data ; On clicking on any JTable cell I found that then only the Table it is showing updated value.

I have a JTable which is under a ScrollPane which is under a JPanel.

Every time a action is performed I am performing the following action to update a JTable.

0. disabled & enabled the JTable.

1. updating & repaint the Panel

2. updating & repaint the JScrollpane

3. updating & repaint the JTable

It is not working please help........


 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Define "updating" the JTable? Are you updating the JTable's model? Because that's mainly what you need to do.
 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pete stein wrote:Define "updating" the JTable? Are you updating the JTable's model? Because that's mainly what you need to do.



Yes sir I am updating the Table Model.
In My Table Model class I have a List as a reference Whenever I am adding or deleting any data , I am fetching the updated Data from Database and passing the updated list to the Table Model.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you firing the appropriate events when you change the model? If you use / extended DefaultTableModel and are using addRow etc to change the model then the answer is yes - DefaultTableModel does all that for you.
 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It worked as you guided ... Thanks a Billion....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic