Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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 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 not autorefreshing when user clicks on specific row

 
Greenhorn
Posts: 3
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiii...I got this weird problem. my Jtable is refreshing after every 5 seconds .Basicaly i have a function which gets called after every five seconds .Wht this function does is ..It takes values from database stores it in new DefaultTableModel and then through setModel function of JTable ,DefaultModel is added to JTable.Everything works fine but the problem is whenever the user clicks on a particular cell or row ,JTable doesnt get refreshed anymore.Any help would be highly appreciated.I tried fireTableDataChanged and wht not..Dont know how to approach




Currently my database doesnt change automatically so i have inserted a count variable to check if the code is working properly .Have a look at line
obj[i][j] = rsView.getString(j) + ""+count;
 
Rancher
Posts: 3324
32
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't use a TimerTask.

Instead use a Swing Timer.

All changes to the GUI should be done on the Event Dispatch Thread (EDT). Read the section from the Swing tutorial on Concurrency for more information.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic