Geertjan's Blog

  • April 10, 2008

JFugue in an Applet Deployed in a JNLP File

Geertjan Wielenga
Product Manager
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.

Join the discussion

Comments ( 3 )
  • Ihs Friday, April 11, 2008

    May I suggest a topic for next entry? :) "Separation of api and implementation in netbeans (platform) modules". I am already working on some GUI, that displays data provided by another module. I would like to be able to have several different implementations of backend provider (let's say: "remote provider", "local provider", "mock provider") and be able to exchange them depending on my needs. In normal app I would use local or remote providers. But when testing GUI I would use "mock" one.

    Any hints for literature regarding this topic is also welcome :)


  • Geertjan Friday, April 11, 2008

    There's a complete 4 part tutorial on this topic, starting with part 1:


  • David Koelle Thursday, May 1, 2008

    I love it! And not just because of the JFugue bit. Making the Java plugin for browsers work seamlessly is critical if Java is going to have a role in the world of web-deployed software. I was always unhappy that Java applets were viewed with limited credibility, and I'm glad to see that's changing.

    And, shameless plug... a new version of JFugue has just been released!

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.