File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Streaming data to a view (JTable??) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Streaming data to a view (JTable??)" Watch "Streaming data to a view (JTable??)" New topic
Author

Streaming data to a view (JTable??)

Abbi Taj
Greenhorn

Joined: Feb 23, 2001
Posts: 3
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

Joined: Sep 29, 2000
Posts: 8521
If you put your JTable on a JScrollPane, it will provide the scrolling functions.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Abbi Taj
Greenhorn

Joined: Feb 23, 2001
Posts: 3
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

Joined: Feb 24, 2001
Posts: 54
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


Brett Spell<BR>Author, <B><A HREF="http://www.amazon.com/exec/obidos/ASIN/186100382X/ref=ase_electricporkchop/105-8609264-3147921" TARGET=_blank >Professional Java Programming</A></B>
Abbi Taj
Greenhorn

Joined: Feb 23, 2001
Posts: 3
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

Joined: Jul 27, 2001
Posts: 1
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Streaming data to a view (JTable??)
 
Similar Threads
JTable question
how to populate a large record set into JTable
JTable
updating JTable
JTable(!!!)