This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Implementing a Dynamic JTable  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have a JTable in an Applet which is reading data from a textfile.The data changes and I need to reflect the changed data in my applet (JTable).
Can you guys shed light how I can display changing data.Let's say a new row that gets added.Any help will be much appreciated.
Cheers
 
Ranch Hand
Posts: 156
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solution 1:
===========
You can use Refresh command in browser tag to refresh page.

Solution 2:
===========
Use timer and after defined interval get data that are greater than shown data in JTable.

Like if ur last data have ID=1230 then make query and get Data
that are >1230.

Here only particular rows would be fetch and u can add into ur JTable. But in Solution 1 whole page would be refreshed. It will take time to load data onto page.

Hope this will help you out.
 
Bartender
Posts: 9559
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Tutorial has an example of a dynamic JTable. You add the new data to the JTable's model (which is what Anand is describing in his second example), then you tell the JTable that the data has changed with an event.
 
John Pa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys.Will try it out.
 
Hold that thought. Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!