The Artima Developer Community
Sponsored Link

Java Community News
New and Updated Desktop Features in Java SE 6

2 replies on 1 page. Most recent reply: Feb 20, 2007 10:21 AM by Mark Nuttall

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

New and Updated Desktop Features in Java SE 6 Posted: Feb 19, 2007 1:40 PM
Reply to this message Reply
Some of the most significant improvements in JDK 6 address user interface-related features. In a article, Robert Eckstein highlights the use of splash screens, the system tray API, LCD text rendering, and refactored AWT drawing operations that in some cases result in an over ten-fold performance increase.

Among the—literally—most visible new features in JDK 6 address long-standing user-interface issues, aiming to make Java an attractive platform for rich-client and desktop applications. In a article, New and Updated Desktop Features in Java SE 6, Robert Eckstein reviews some of the most significant such JDK 6 features.

Performance improvements required perhaps the most dramatic refactoring of Swing and AWT code, according to the article, but also provide the most dramatic improvements compared with earlier JDK versions. Most performance related changes come from single-threading UI updates in the OpenGL event pipeline. Swing components, for example draw their UIs using the Java2D API that, in turn, relies on AWT for primitive drawing operations. One way in which AWT performs such operations is via the OpenGL library, the source of some of the biggest performance gains:

Until now, Java 2D rendered its graphics on arbitrary Java threads. With single-threaded rendering (STR), requests are now queued at the Java platform level, then executed at the native operating system (OS) level on a single thread... At present, STR is implemented only in the OpenGL rendering pipeline, which is not enabled by default due to various driver and hardware issues.

In addition, JDK 6 also features many improvements to how small drawing operations that make up the bulk of a Swing application's life are performed:

"Small" refers to operations in which only a few pixels are touched—for example a 10x10 pixel fillRect() operation. Reducing overhead in these cases is very important in improving overall Swing performance because Swing typically touches small areas at a time.

For example, if you click a JButton, a small area is filled with a color or gradient, then a few lines and some text are rendered on top of that. Anything that can get those pixels on the screen sooner will improve users' perception of the responsiveness of Swing applications.

The combined effects of those improvements are a manifold increase of UI performance. The article quotes several benchmark results, including the following:

  • SwingMark, an internal Swing benchmark, is approximately 15 percent faster.
  • The drawString() method is about 250 percent faster, according to J2DBench.
  • The fillRect() and drawLine() methods are up to 2500 percent faster, according to J2DBench.
  • FireStarter, an internal demo, renders about 2600 transformed, filtered, blended sprites per frame at 30 frames per second, as opposed to only 1600 sprites before STR.

In addition to performance, the article surveys a few additional Swing and AWT improvements as well, such as:

  • Splash screens:

    Splash screens are a standard part of any modern graphical user interface (GUI) application. Before Java SE 6, you could use Swing or ... AWT to create splash screens in Java technology applications. However, before the splash screen can pop up, the application has to load and initialize the ... JVM, AWT, usually Swing, and perhaps some application-dependent libraries. The resulting delay of several seconds has made use of a Java ... splash screen less than desirable.

    Java SE 6 provides a solution that allows the application to show the splash screen much earlier, even before the virtual machine starts. Now, a Java application launcher is able to decode an image and display it in a simple nondecorated window.

    Displaying a splash screen with JDK 6 is as simple as invoking the Java process with a parameter, java -splash:filename.gif SplashTest, or specifying a SplashScreen-Image value in an application's executable JAR archive.

  • System tray API:

    The system tray is a specialized area, typically at the bottom of the desktop where users can access continually running programs...

    Java SE 6 lets you access the system tray in Java technology with the help of two separate classes in the java.awt package: SystemTray and TrayIcon. These classes give you the ability to add graphics, pop-up menus, and floating tip functionality to the system tray...

    The SystemTray contains one or more TrayIcons, which are added to the tray using the add() method and which are removed when no longer needed with the remove() method.

  • True double buffering:

    Each application window now has an offscreen duplicate image, known as a back buffer, that is kept synchronized with the onscreen window. When a window is exposed, Swing simply copies directly from the offscreen image, on the toolkit thread, to the screen...

    With this new approach, Swing now has a separate buffer for each Swing window on the screen, and those buffers' contents are kept synchronized with the graphics in the actual window... If you drag a window across the Swing application window, Swing can simply copy from the back buffer to the screen and save all the work of erasing and then repainting that area... What's more, Swing does this fast-copy operation on the native event thread, which means that there is an immediate response.

  • LCD-optimized font rendering:

    This is an optimization for LCD displays that uses subpixel striping to increase the text resolution. Because of the way users apply and configure it, subpixel text is often considered a form of text antialiasing.

    The good news is that JDK 6 implements this feature. Whether you use the look and feel of Metal, Microsoft Windows, or GTK, you will get the same antialiasing behavior for fonts in Java technology-based applications as you do in native applications.

    In order to achieve this, the look and feel of Windows and of GTK have also been updated to track the user's desktop preferences and update any preference changes in real time.

  • Integration with native theming:

    One of the most popular theming applications for Windows is WindowBlinds. In fact, WindowBlinds was so popular that Microsoft worked with the product's author to develop a new API that exposes the rendering of Windows controls: the UxTheme API. Windows XP provides a new default XP look and feel, based on UxTheme, that users can extend using the UxTheme API...

    After some discussions between engineers from the Swing team and from Microsoft's graphics team, the Microsoft team suggested that the way to work with the Windows Vista themes was to use the UxTheme API. So a few Swing-Windows look-and-feel authors prototyped a version of the Windows XP look and feel that uses the UxTheme engine to perform the rendering of Swing components. The authors then tested the prototype under Windows Vista and found that the rendering of the Vista theme was pixel perfect with UxTheme. This lead us to the re-implementation of the Windows look and feel using UxTheme, and this new implementation is available in JDK 6.

What new JDK 6 AWT and Swing feature or improvement is most important to you?

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: New and Updated Desktop Features in Java SE 6 Posted: Feb 20, 2007 3:30 AM
Reply to this message Reply
I think the GUI performance improvements are the most significant ones. Java has been perceived as slow because AWT and Swing are very slow.

Mark Nuttall

Posts: 13
Nickname: mnutty
Registered: Jan, 2007

Re: New and Updated Desktop Features in Java SE 6 Posted: Feb 20, 2007 10:21 AM
Reply to this message Reply
> ... Swing are very slow.

Flat View: This topic has 2 replies on 1 page
Topic: Sun Creates Project Woodstock JSF Repository Previous Topic   Next Topic Topic: Apache Releases Commons Lang 2.3

Sponsored Links


Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use