Riding the Mustang

JSE 6.0 – more than 'bling generation' Java

  • alert
  • submit to reddit

Secure remote control for conventional and virtual desktops

The Java Platform, Standard Edition 6 JDK (variously called JSE 6.0, Mustang and, by many, J2SE 6.0; and, by some at least, JDK 6) has been in Beta 2 release format for some months and is nearing its actual release date (work started on this release around July 2005 and it is currently expected to be delivered in autumn/fall 2006).

As such, it is worth taking a brief look at what this new version of the core Java elements provides. In essence, J2SE 6.0 is basically the JDK 1.6 and builds on what has gone before - it certainly isn't as radical a development as the last release – it provides many "nice to have" features without, this time, actually affecting the core language.

Since the JSE 6.0 version has been released, I have been monitoring various discussion groups and forums to gauge informed opinion on its features. In fact, one of the most cutting comments I have seen described this version of Java as being "Java for the bling generation" - implying that it was full of eye candy style features but with little of substance. So is this fair?

What is in JSE 6?

Well, certainly, compared to the last release of Java (Java Standard Edition 5.0) the changes are far less fundamental – the language isn't changed, for example.

However, if you look under the covers, a number of features have been added which strengthen the previous release, and by the far the largest number of changes (at least from a developer's perspective) are in the area of GUIs – an area which was hardly touched by the last release. I must confess a certain love for GUI work (and Swing in particular) at this point, and a number of features I have wanted in the core Java have now appeared, including the ability to set the frame icon, system tray icon support, and a splash screen that doesn't need the whole JVM loaded before it will display. These may seem like little things, but for commercial-quality desktop software they are very important to the overall look and feel.

So what does the next release of Java have in store for us all?

Essentially it can be divided up into a number of areas:

  • GUI and Swing work: Numerous additions are included here. We have already mentioned some, but others include sorting and filtering included in JTables, support for GUI components to be used on the tabs of a JTabbed pane, general improvements to the look and feel on Windows and other platforms, overdue improvements to Swings drag-and-drop facilities, improvements for double buffering and test printing. It also includes more and improved support for graphics rendering and improved support for LCD oriented fonts. Finally, the SwingWorker example, used by many, has been incorporated into the core language.
  • Runtime performance: There are noticeable improvements in the performance of the JVM with source code running significantly faster on 6.0 than on previous versions. Various people have made different claims for the performance gain – having only used this version with a couple of (reasonably large) desktop applications all I can say is that they seem to start up quicker and run faster – so the claim may well be justified.
  • Built in Scripting support: In the next version of Java we will be able to embed scripting languages such as PHP and JavaScript into our applications. This may make it easier to allow business rules to be dynamically defined etc. The new JavaScript engine and javax.script API are based on the Mozilla Foundation's open source Rhino implementation of JavaScript.
  • Web Services: The support included in this version of Java for Web Services makes it much easier for developers to publish a web service. In this version of Java you publish a Web Service merely by using some simple annotations. For example, to make a class Spellchecker into a web service all we need to do is to add an annotation, for example:
    • import javax.jws.WebService;
      public class Spellchecker {
  • Database: The updated JDBC 4.0 provides numerous features to make it easier to use. For example, there is no longer a need to register a JDBC driver before using it.

Although there are many detailed features, including increased support for annotations, these are (for me) the main features of this release of Java.

Simple Example

As my particular passion is for all things GUI based, I will have a look at some of the Swing related features that I particularly like.

The following simple Java program illustrates some of the things I mentioned earlier.

package com.regdev.swing.Test;

import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class Tester extends JFrame {
    private Desktop desktop;
    private JTextField url = new JTextField("http://", 25);
    private TrayIcon trayIcon = null;

    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Tester t = new Tester();
    public Tester() {
        if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();
    private void initComponents() {
    private void setupFrameIcon() {
        ImageIcon imgIcon = new ImageIcon("images/icon.png");
        Image img = imgIcon.getImage();
    private void setupSystemTray() {
        if (SystemTray.isSupported()) {
            SystemTray tray = SystemTray.getSystemTray();
            Image image = Toolkit.getDefaultToolkit().getImage("images/tray.gif");
            trayIcon = new TrayIcon(image, "Tester2");
            trayIcon.addActionListener(new TrayActionListener());
            try {
            } catch (AWTException e) {
                System.err.println("TrayIcon could not be added.");
    private void setupBrowserPanel() {
        JPanel p1 = new JPanel();
        JButton b = new JButton("Browse");
        b.addActionListener(new URLActionListener());
    class URLActionListener implements ActionListener {

        public void actionPerformed(ActionEvent e) {
            String target = url.getText();
            try {
                URI uri = new URI(target);
                if (desktop != null)
            catch(IOException ioe) {
            catch(URISyntaxException use) {

    class TrayActionListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            System.out.println("In here");
                "Some action performed",

The first thing to note is that this simple application checks to see that desktop support is available. This is done via:

if (Desktop.isDesktopSupported()) {
            desktop = Desktop.getDesktop();

If this is not done then the application may throw a UnsupportedOperationException.

Next we set up the icon to use for the Frame. In Windows this is the icon that sits in the left hand corner of the main window. This is done using the setIconImage(Image i) method. In my case, this places a simple icon in the frame as illustrated below:

Example of a simple JSE 6 application

Figure 1: A simple JSE 6 Swing Application

In this case, the title for the window's frame is also set as "Tester". This means that on the Taskbar also shows this icon and the title Tester. This application also allows a URL to be entered into the JTextField in the main panel and for the Browser button to be used to display the specified URL in the current default browser. In the JSE 6.0 version of Java this is particularly straight forward requiring only:


Finally, the last thing in this example to look at is that the application adds itself to the system tray. This is done using the following lines:

SystemTray tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(image, "Tester2");

The result of this is that in the System Tray I now have a simple icon representing my application:

A System Tray icon

Figure 2: A System Tray icon

The associated ActionListener also allows an action to be performed when the user selects the Icon in the tray.

One final feature that I tried out with this example, which is not illutrated in the source code, is the use of a splash screen. This splash screen is displayed by the underlying native system such that it can be displayed while the JVM is being started up – thus giving the user much needed confidence that their application is indeed running. To do this I used the splash option now available as a JVM option, for example:

java -splash:images/splash.gif com.regdev.swing.Test.Tester

The splash screen can also be specified in the manifest file for a Jar so that it does not need to be specified on the command line.


Although to many the new features in JSE 6 are far less revolutionary then those found in the last release of Java, they are certainly evolutionary and, for those who might use them, extremely useful. If nothing else the apparent performance improvement is welcome and the new features all eminently sensible.


https://jdk6.dev.java.net/ http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/index.html http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/enhancements/index.html http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/index.html http://weblogs.java.net/blog/shan_man/archive/2005/06/improved_drag_g.html http://www.mozilla.org/rhino

Security for virtualized datacentres

More from The Register

next story
PEAK APPLE: iOS 8 is least popular Cupertino mobile OS in all of HUMAN HISTORY
'Nerd release' finally staggers past 50 per cent adoption
Microsoft to bake Skype into IE, without plugins
Redmond thinks the Object Real-Time Communications API for WebRTC is ready to roll
Microsoft promises Windows 10 will mean two-factor auth for all
Sneak peek at security features Redmond's baking into new OS
Mozilla: Spidermonkey ATE Apple's JavaScriptCore, THRASHED Google V8
Moz man claims the win on rivals' own benchmarks
Yes, Virginia, there IS a W3C HTML5 standard – as of now, that is
You asked for it! You begged for it! Then you gave up! And now it's HERE!
FTDI yanks chip-bricking driver from Windows Update, vows to fight on
Next driver to battle fake chips with 'non-invasive' methods
DEATH by PowerPoint: Microsoft warns of 0-day attack hidden in slides
Might put out patch in update, might chuck it out sooner
Ubuntu 14.10 tries pulling a Steve Ballmer on cloudy offerings
Oi, Windows, centOS and openSUSE – behave, we're all friends here
prev story


Choosing cloud Backup services
Demystify how you can address your data protection needs in your small- to medium-sized business and select the best online backup service to meet your needs.
A strategic approach to identity relationship management
ForgeRock commissioned Forrester to evaluate companies’ IAM practices and requirements when it comes to customer-facing scenarios versus employee-facing ones.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
New hybrid storage solutions
Tackling data challenges through emerging hybrid storage solutions that enable optimum database performance whilst managing costs and increasingly large data stores.
Protecting users from Firesheep and other Sidejacking attacks with SSL
Discussing the vulnerabilities inherent in Wi-Fi networks, and how using TLS/SSL for your entire site will assure security.