Skip to main content

how to do big table pagination reading from database with jtable?

2 replies [Last post]
kevinatgz
Offline
Joined: 2009-04-30

I've tried but the button was frozen after i clicked "read from db" button.
could anyone give some examples? thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rturnbull
Offline
Joined: 2005-08-27

> I've tried but the button was frozen after i clicked
> "read from db" button.
> could anyone give some examples? thanks.

As a guess, I'd say you are doing the database read on the EventDispatchThread (EDT).
You need to move it off. If you are at Java 1.6, see SwingWorker.
http://java.sun.com/javase/6/docs/api/index.html?javax/swing/SwingWorker...
Note you will still need to update the table on the EDT

Prior to 1.6 you'll have to do it yourself. See Tutorial
http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html
Or you could get a previous version of SwingWorker from https://swingworker.dev.java.net/

kevinatgz
Offline
Joined: 2009-04-30

thanks, problem is solved.