• 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

Streaming data to a view (JTable??)

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic