The Source for Java Technology Collaboration
User: Password:



Kirill Grouchnikov

Kirill Grouchnikov's Blog

Matrix screensaver for Swing apps

Posted by kirillcool on June 22, 2006 at 09:05 AM | Comments (5)

The last thing i did before moving to the States was taking one of my old apps (written for Java 1.1, so the entire imaging stack was written from the ground up, including the alpha channel blending, antialiased line drawing, index color models and such) and turning it into a Swing screensaver. The project page is right here, and once you run your application under laf-widget compliant look and feel, simply place matrix-rain.jar in the classpath and press Ctrl+Alt+M in your frame. Here are a few screenshots of the screensaver in progress:



If you decide to use the screensaver in your app, you may need to specify the heap size to be 256 or 378 megs, since some of the stuff is precomputed for smoother animation framerate. Last thing - this was written back in 2000-2003, so don't view the code as the correct way to use Java2D (since it doesn't use any).

Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Cool! Do you have a WebStart version available, by any chance?

    Posted by: jdinkins on June 22, 2006 at 09:14 AM

  • Sorry - not until my home computer gets here (in about 6-7 weeks). For now, here is how you can see it in action:

    Go to Substance site and download the latest substance.jar and substance-tst.jar from dev 3.0
    Go to Matrix Rain site and download the matrix-rain.jar
    Run the following: java -Xmx256m -cp substance.jar;substance-tst.jar;matrix-rain.jar test.check.SampleFrame
    Press Ctrl+Alt+M

    I realize this is somewhat inconvinient without WebStart, but with my home computer being in mid-Atlantic (hopefully not sinking), this is the best i can do for now.

    Posted by: kirillcool on June 22, 2006 at 11:09 AM

  • Wow the screenshots are truly truly spectacular! That is amazing work! Now to the bad part and part of the reason why Java will never ever be so popular on the mainstream side of desktop apps....did you say set the heap to 256 MB?! That much memory for a screensaver? Is it just me or does anyone else think that is a bit steep for a screensaver?

    My post is not meant to put a damper on things but rather to point out simply people who are not using Java will laugh at the memory requirements to run a screensaver albeit an incredibly cool looking one.

    Now where is that webstart for this?

    Posted by: suryad on June 22, 2006 at 03:58 PM

  • suryad,
    As said at the end of the entry, this was written back in 2000-03 and has its own graphics stack implemented (no Graphics2D, no BufferedImage, ...). Due to the heavy nature of the computations involved (especially in computing the phosphorescent radiation clouds around the zoomed-in matrix letters), some part of the animation sequences are precomputed (otherwise it wouldn't be much of animation). This is why some of the animation frames are stored in a cache and later on displayed. Since no use of fancy (hardware-accelerated) Java2D stuff is used, the stored animation frames may take some space (depending on the size of your app frame). Without the title letters falling and zooming, there is really no need for all that extra memory. However, this part is the integral part of Matrix trilogy trailers, and that's why it's here.
    Regarding the WebStart - see my previous comment of why it's not available.
    In addition, this entry is aimed to show the power of laf-widget layer rather than provide a real-life fully optimized Swing screensaver. It took about two hours to extract this code from the old project and "widgetize" it, but it will take much more than that to move it into the "true" world of modern (1.4+) JDKs.

    Posted by: kirillcool on June 22, 2006 at 04:05 PM

  • Really beautiful works !

    I think you had spend lot's of time doing this sutff, but lot's of feature can be re-used in substance. Especially glowing letters...

    Posted by: alois on June 23, 2006 at 07:03 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds