• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Streaming data to a view (JTable??)

 
Abbi Taj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am accessing a database and wish to stream data into a database viewer (component).
The resultset may well be very large (over 10,000 records).
I wish to display say 50 records to begin with, then as the user scrolls up and down the viewer further records are read and displayed.(I am not using JDBC)
Can I get a JTable and the TableModel to behave in this manner?
Is there any third party (affordable) components that offers these services?
Thanks in advance for any advice and pointers
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you put your JTable on a JScrollPane, it will provide the scrolling functions.
 
Abbi Taj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cindy Glass:
If you put your JTable on a JScrollPane, it will provide the scrolling functions.

Cindy
Thanks for your response.
By putting the JTable into a JScrollPane will give me the scrolling functions but all the data will be loaded into the TableModel (something I want to avoid as this could take several minutes).

 
Brett Spell
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abbi,
I'm a little unclear on exactly what your application is doing, because you said that you're accessing a database but that you're not using JDBC. In any case, the answer is that what you want to do is possible, because data isn't retrieved from a TableModel until it's actually needed. In other words, you don't have to have all of the table data loaded into memory at once.
------------------
Brett Spell
Author, Professional Java Programming
 
Abbi Taj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have decided not to read all of the data into to the model. The model will now request the data source for the rowCount and getValueAT. The model will however hold a cache of data in order to reduce the costly requests to the data source.
This approach is working fine.
Thanks for your help
 
javed alam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a similar problem,i.e having large amount of data and trying to display them in JTable in increment of say 100.The problem here is that I want to give user an illusion that He has got all the available data (Say total number of record:5000), It means that scrollbar on the scrollpane should behave as if the JTable has got all the records(say 5000) but physically the table is holding just 100 records. Can you please give me a hints or piece of your source code how you are achieving this,
Thanks
Originally posted by Abbi Taj:
We have decided not to read all of the data into to the model. The model will now request the data source for the rowCount and getValueAT. The model will however hold a cache of data in order to reduce the costly requests to the data source.
This approach is working fine.
Thanks for your help

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic