Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollPane is not reloading the table

 
Kushi Gadiparthi
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,
 
Paul Clapham
Sheriff
Posts: 21316
32
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
Sheriff
Posts: 21316
32
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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic