|
So I have been experimenting with SwingWorker, as promised, and this:
is the result.
source code and
binaries provided. To run
the demo you'll need SwingWorker.jar and
a JDK5.0 JVM. If you have JavaWebStart (JDK 5.0) installed then press here
Then run the stuff as this:
java -cp MANDELBROT.jar:SwingWorker.jar -jar MANDELBROT.jar
Once upon a time Mandelbrot fractals where fashionable. I remember programming them a long time ago, and I also remember how slow to compute they were. I thought that math would be a nice thing to do in a SwingWorker. The fact is that I can navigate the Mandelbrot fractal (and zoom and pan it) quite fast in my current computer (a Pentium IV)!!. Things have improved a lot since then!!
The examples
By building this simple demo I've seen some do's and don'ts with SwingWorker. I'll post on this later this week.
Keep swinging,
Antonio
| UPDATE: |
The correct command line is
java -cp swing-worker.jar:MANDELBROT.jar org.jdesktop.swingworker.demos.mandelbrot.MandelbrotViewController
|
|
Enviado por Sebastien Stormacq en agosto 11, 2005 a las 07:36 PM CEST #
Of course, if you have a dual core CPU then things are faster, because usually the computing Thread is executed in a CPU while the rendering one is executed in the other CPU.
Regarding the timer suggestion, thanks!! I think it's a very good idea. The stuff is too fast to be seen. It's not good usability to show/hide stuff in a GUI so quickly. It's an improvement for the next release ;-).
Enviado por Antonio en agosto 12, 2005 a las 08:13 PM CEST #