Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JScrollPane is not reloading the table

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can any help me in JScrollPane,

the Jscrollpane is not reloading the table based on the query,

for the first time it is displaying the table and if I pass some date and make changes in the table columns and when I try to reload it ,
It is not reloading the new table,

I am using the code as follows


I will be very thankfull if anyone helps me,
I am loading the JScrollPane in Process() method,

everytime I call the Process() method then the scrollpane should load a new table but it is not doing so,

Can any one please suggest an idea,

Thank you very much,
 
Marshal
Posts: 25669
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There was a lot of code in that process() method which was irrelevant to your question. Even worse, there was code which was commented out. That takes up space and it's distracting. Not to mention that random indenting makes it hard to read code. But it looked to me like you were creating a new JTable object. Is that right? The usual way to update a JTable with new data is to create a new table model and call the JTable's setModel() method.

If that doesn't help, perhaps you could create a shorter (much shorter) example which displays your problem. Just something which reloads the table. No buttons, no unrelated field, no commented-out code, just code which displays the problem and nothing else.
 
Kushi Gadiparthi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul Clapham Sir,

Thank you for your reply,

Here I am giving the code which I am getting the problem



Here is the problem where I am calling the getdata("DSSDEV", startDate1);

My JScrollPane is not clearing the table and it is not reloading the new table based on startDate1

So, please have a lokk and suggest me an idea,

Thank you very much,
 
Paul Clapham
Marshal
Posts: 25669
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kushi Gadiparthi wrote:So, please have a lokk and suggest me an idea



Paul Clapham wrote:But it looked to me like you were creating a new JTable object. Is that right? The usual way to update a JTable with new data is to create a new table model and call the JTable's setModel() method.



So, you were doing what I thought. Then do what I suggested.
 
Kushi Gadiparthi
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul Clapham,

Thank you very much for your reply,

Thanks a lot,
 
Normally trees don't drive trucks. Does this tiny ad have a license?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic