File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Displaying data in JTable which has pagination. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Displaying data in JTable which has pagination." Watch "Displaying data in JTable which has pagination." New topic
Author

Displaying data in JTable which has pagination.

chevalier fo
Greenhorn

Joined: May 23, 2012
Posts: 3
I am using java swing to display data from my table and using JDBC to retrieve my result. I am trying to implement pagination on my table but i am unable to retrieve data in JTable along with the pagination. Code is as under:

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

What exactly isn't working?
chevalier fo
Greenhorn

Joined: May 23, 2012
Posts: 3
Wendy Gibbons wrote:What exactly isn't working?

I am trying to retrieve the data from database in JTable which has pagination in it. Pagination works perfectly and so as data retrieval but when i combine them ...things go wrong..
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

how does it gor wrong, what sympton are you getting?
chevalier fo
Greenhorn

Joined: May 23, 2012
Posts: 3
Seems like you are intrested in code.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3611
    
  60

chevalier fo wrote:Seems like you are intrested in code.

Actually, it's exactly the other way around. People here would like to help you, but very few people have the time, patience and willingness to comb through 300+ lines of code with Swing and JDBC intermixed together.

Separate the pagination from the JTable code. Show us how it works separately, and describe in detail how it does not work when put together. Then it's probable someone here will have a look and help you. See SSCCE, ShowSomeEffort and TellTheDetails for more information on this (click the links).

(I, personally, would not use SwingWorker to display records as they are retrieved. Use it to load the whole batch at once in the background (this is good), but not to add records on the fly. Mixing Swing and JDBC code is bad. At the very least, you should have separate methods to read the data from a database, with parameters specifying all that is necessary to read them - such as the first and last record to retrieve.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying data in JTable which has pagination.