Working out Swing with SwingWorkers

First of all: Happy New Year, everybody!

So say you have to do some heavy-duty tasks in your Swing application and that you need to span a worker thread to do that. Then you have to interact again with Swing components, using the Swing thread, of course. Of course using a thread pool would be nice, to speed up task creation and to reduce/control resource consumption.

I have been playing a little bit with the new concurrent utilities included in JDK 5.0 and, in fact, all this stuff is very easy to do. You can find a draft implementation here.

It's basically a rewrite of the famous SwingWorker with some clean-up (you just need an interface now) and with an ExecutorService used to pool threads.

So please if you use SwingWorkers give it a try and let me know how well it fits your needs.

Have fun in 2005!

Comentarios:

Enviar un comentario:
Los comentarios han sido deshabilitados.
About

swinger

Search

Archives
« abril 2014
lunmarmiéjueviesábdom
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Hoy