• Post Reply Bookmark Topic Watch Topic
  • New Topic

Implementing a Dynamic JTable

 
John Pa
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
 
Anand Karia
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.
 
Joe Ess
Bartender
Posts: 9362
11
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.
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!