Thursday Apr 10, 2008

JFugue in an Applet Deployed in a JNLP File

Here is a JEditorPane in an applet. I can type in JFugue notation and press Play and then the JFugue API is used to play the notes in the background via the JDK 6 SwingWorker class, so that you can scroll in the JEditorPane while the music is playing:

That's just a demo of any old applet. That's not the point of this blog entry. The point is the deployment of the notoriously clunky applet technology. Let's take a look at the applet's tags in the JSP file that launches it. Take note especially of line 21, which sets the JNLP file that actually launches the applet:

Also take note of the fact that you can set JVM arguments... on a per-applet basis! And here's the JNLP file, with line 11 specifying the location of the JAR, which used to be done in the applet tag, above. So, clearly, the JNLP file has taken over the responsibility of loading the applet JAR:

And performance? Couldn't be better. What about those wacky dialogs that you'd get whenever you load an applet? And the freezing of the browser? Forget about those, file them away as history. Seriously. None of that's anywhere to be seen anymore. All you need is JDK 6 Update 10 (Beta, or some dev build), together with FireFox 3 (also Beta, or some dev build). All this and more, together with a list of demos you can look at once you're all set up, in Applets Reloaded: An Overview of New Tags and Demos on Javalobby.


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« April 2008 »