Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Get the New SaverBeans Screensaver Pack

 
By Kammie Kayl, June 10, 2004  
Desktop Java technology is unleashing many new and exciting projects that developers should know about and will probably want to get involved with. The first is a new, early access Java screensaver software development kit (SDK) called the SaverBeans Screensaver SDK that was recently developed and released on java.net by Sun engineer Mark Roth. Using the tools in the SDK, you can produce screensavers for the Windows, Solaris, and Linux platforms by writing a set of Java classes along with an XML description of the screensaver settings. The resulting screensavers behave just like native screensavers, with preview capabilities and the ability to control settings.

Once you download the SDK, you can contribute to the SaverBeans Screensaver Pack, a collection of open source screensavers submitted by members of the Java community. If you get involved with this community project now, you can have the chance to show off your creative work and get a JavaDesktop T-Shirt during the Free T-Shirt Giveaway and JavaOne Show-Off at the 2004 JavaOne Conference in San Francisco. Judges will be looking for the first 20 working screensaver submissions created from the community.

The SaverBeans SDK is a part of a larger java.net project called the JDesktop Integration Components (JDIC) project. This project will enable applications written for the Java platform (Java applications) to integrate more seamlessly with their native desktop environment. Initially the project supports features such as embedding the native HTML browser, programmatically opening the native mail tool, using registered file-type viewers, and packaging JNLP applications as RPM, SVR4, and MSI installer packages.

The rest of this article covers the following SaverBeans topics:
 
The Major Components of the SaverBeans SDK
The SaverBeans SDK does not itself contain any screensavers, as it is a development kit for producing them. The SaverBeans SDK contains the following components:
  • SaverBeans Ant Task JAR - A JAR required by screensaver projects, used to produce native screensavers.
  • SaverBeans API JAR - These are redistributable files to be included with your generated screensavers.
  • SaverBeans API Documentation - A Javadoc for the SaverBeans APIs.
  • Screensaver Startup Kit - A sample project including a build file, skeleton screensaver, and configuration file.
 
Screenshots and Code of Sample Screensavers
Two example screensavers are included in the SaverBeans Screensaver Pack.
 
Bouncing Line Screensaver

Bouncing Line Screensaver
This is a good starting point for you to write your
own screensavers from. (click image for full size)
 
The following code sample displays the paint method which paints the next frame of the screensaver. It erases the old line and paints a new line.
 
    public void paint( Graphics g ) {
        Component c = getContext().getComponent();
        int width = c.getWidth();
        int height = c.getHeight();
        
        // Erase old line:
        g.setColor( c.getBackground() );
        g.drawLine( p1.x, p1.y, p2.x, p2.y );
        
        // Move points and bounce off walls:
        bounce( p1, dir1, width, height );
        bounce( p2, dir2, width, height );
        
        // Draw new line:
        g.setColor( lineColor );
        g.drawLine( p1.x, p1.y, p2.x, p2.y );
    }
 
 
BlackGlass Screensaver

BlackGlass Screensaver
The BlackGlass screensaver is more complex. It rotates a number of beans
around a central axis, displaying the beans' reflections on the black
sheet of glass at the bottom of the screen. (click image for full size)
 
The following code block from the BlackGlass class displays the paint method, which paints a single frame of this screensaver.
 
    public void paint( Graphics realG ) {
        Component c = getContext().getComponent();
        if( (offScreen == null) || (offScreen.getWidth(null) != c.getWidth()) ||
            (offScreen.getHeight(null) != c.getHeight()) ) 
        {
            if( offScreen != null ) {
                offScreenGraphics.dispose();
            }
            offScreen = c.createImage( c.getWidth(), c.getHeight() );
            offScreenGraphics = offScreen.getGraphics();
        }
        Graphics g = offScreenGraphics;
        Graphics2D g2D = (Graphics2D)g;
        
        // Draw glass
        g.setColor( Color.black );
        g.fillRect( 0, 0, c.getWidth(), c.getHeight() / 2 );
        g.setColor( GLASS_COLOR );
        g.fillRect( 0, c.getHeight() / 2, 
            c.getWidth(), c.getHeight() / 2 );
        
        // Draw ball cloud reflection:
        ballCloud.renderBottom( g, c, beanBall );
        
        // Draw ball cloud:
        ballCloud.renderTop( g, c, beanBall );
        
        // Blit frame:
        realG.drawImage( offScreen, 0, 0, null );
        
        // Update animation:
        ballCloud.animate();
    }
 }
 
 
How to Download and Install Screensavers
To download and install one or more screensavers:
  1. Visit the screensavers project on java.net.
  2. Download each screensaver from the java.net Downloads section. Make sure you select the correct download bundle for your platform.
  3. Follow the instructions in the README.txt file included with the screensaver.
You can also check out the source code via CVS to manually build the screensavers.
 
Free T-Shirt Giveaway and JavaOne Show-Off
To kick off this project and to encourage the proliferation of creative Java screensavers, the JavaDesktop team is giving away a free JavaDesktop T-Shirt to the first 20 working screensaver submissions from the public. In addition, the coolest screensaver submitted (as judged by the presenters) will be featured at the What's New in Desktop Java Technology (TS-1370) session at JavaOne San Francisco 2004. The best screensavers will also be showcased at the JDIC demo pod in the pavilion. And of course, all submitted screensaver code will be available for download from java.net. Visit https://screensavers.dev.java.net/ for the giveaway rules and entry details.
 
About the JavaDesktop Community and java.net
JavaDesktop is a java.net community dedicated to helping members of the Java platform's graphical user interface (GUI) community. On javadesktop.org you'll find news, discussions, technical articles, and open source projects that use the Java 2 Platform, Standard Edition (J2SE) APIs to produce applications with rich client interfaces.

java.net is the realization of a vision of a diverse group of engineers, researchers, technologists, and evangelists at Sun Microsystems, Inc. to provide a common area for interesting conversations and innovative development projects related to Java technology. The community continues to grow with industry associations, software vendors, universities, and individual developers and hobbyists joining every day. As they meet, share ideas, and use the site's collaboration tools, the communities they form will uncover synergies and create new solutions that render Java technology even more valuable.

The more time and energy you have to interact with java.net community members, the more organizational exposure you'll gain. The return investment can come in a variety of ways, including the reputation you or your organization earn through leadership roles and contributions to the site and, perhaps more importantly, the market pulse and community needs you discover and leverage.

There are many benefits for individuals as well. Java technology enthusiasts can enhance their own reputation through participation and contributions to the collective community. By participating actively on java.net, members can learn from each other, discover solutions to programming challenges that already exist, find new colleagues and mentors, and have more fun with Java technology.
 
Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.