I am using JProgressBar for Showing The Progress Of Data Loaded From from DataBase . I am using SwingWorker Class To Load The Data In BackGround Thread using Tutorial!
T
You can implement Runnable
; it avoids Future
and generics, but it is easy to get wrong.
This answer compares SwingWorker and Runnable for similar action; SwingWorker
has the advantage, but it requires better knowledge about Java Essential Classes
.
SwingWorker
is proper way and is designated for single long running thread; for multithreading, invoke SwingWorker
from Executor
.
Example about SwingWorker.
Example about get() exceptions from SwingWorker and PropertyChangeListener.