Sunday, May 25, 2008

New job title

Appropriate beverage

I found this appropriately named drink while I was at JavaOne.

Are applets making a comeback?

An interesting article over at JavaWorld dicusses that very topic:

Thursday, May 22, 2008

JavaOne Session Examples

The code examples from the JavaOne Technical Session that I presented a few weeks ago are now available from the Altio site, so for the people who attended the session and asked for the code, head over to and download all the Java source and HTML files that I used.

I haven't included the Altio application examples, but I can make them available as well if anyone needs them.

Tuesday, May 20, 2008

Compiled JavaFX in Swing applications

[Update: I got this working with the JavaFX preview release - see this blog entry]

I've integrating interpreted JavaFX script widgets into Swing applications by using the Java 6 Scripting Engine to execute the script and have the JavaFX widget add its Canvas component to a passed in Swing parent component to allow it to integrate with the Swing application seamlessly.

So, after returning from JavaOne I was keen to integrate compiled JavaFX widgets in a similar way, to give better performance and easier deployment of multi-script JavaFX code. I thought it would be fairly simple, but I hit a few hurdles along the way.

My first idea was to extend a custom Java class in JavaFX to easily add the widget to Swing. I hit a snag when I couldn't figure out how to implement constructors in JavaFX that Java can recognise.

I tried things like:

public class javafxtest {
public function javafxtest(val1: String; val2 : String) : javafxtest {
return this;
But whatever I did in JavaFX, Java only saw an empty constructor and another that took a boolean.

So I gave up on that and just defined an interface in Java that I then implemented in JavaFX, and that went well for a while - it's easy enough to implement interfaces in JavaFX, and I could obtain a reference to the JavaFX implementation from Java and call methods on it. So, if I call a method on the JavaFX widget that returns a JComponent then I can add that as a child of a Swing container and have integration that way, right?

Well, maybe, but I seem to have a fundamental JavaFX problem that's stopping it working. The same code works when I run the JavaFX script from the command line:

public function setupCanvas() {
var c3:Canvas = Canvas {
content :
Text {
content: "A JavaFX widget!"
At runtime in my Swing application I get the following Exception when I call that JavaFX method:

Caused by: java.lang.NoSuchMethodError: javafx.ui.Canvas.(Z)V
at javafxtest.altiotest.setupCanvas$impl(altiotest.fx:77)
at javafxtest.altiotest.setupCanvas(altiotest.fx:28)
at javafxtest.altiotest.getControlComponent$impl(altiotest.fx:101)
And, er, that's as far as I can get.

I'm presuming this is because the JavaFX SDK is not finalised, that I'm using the latest OpenJFX compiler in a beta version of the Java6 JVM and I've finally tipped over the bleeding edge onto the other side where nothing works. But still, it should work, I think, so if anyone has any ideas please let me know.

Wednesday, May 14, 2008

Dragging Altio applets out of the browser

After experimenting with dragging simple applets out of the browser I tried to add the same functionality to Altio applets. This turned out to be trickier than I anticipated, mainly because AltioLive generates the APPLET tags in the HTML dynamically, setting lots of parameter values, dynamically selecting which Altio JAR and custom control JARs should be included.

I thought that I could just keep static values in the JNLP file and maintain the dynamic values in the APPLET tag, and this does work for dragging the applet out of the browser, however if you then close the browser then as far as I can tell your applet is 'magically' transformed into a Webstart application, which makes sense. This means that upon closing the browser Java will throw away your APPLET tag and rely solely on your JNLP file to support your applet, and will reinitialize your application based on that JNLP file, so if it doesn't contain all of the information necessary to your applet it will fail when Webstart takes over.

So, it looks like we are going to have to have dynamic JNLP files for AltioLive. The easiest way I can see to do this is to use JSP file that takes in a load of parameters, which are then used to fill in the JNLP and return it. We can embed a link to this JSP file, including all parameters, when we create the APPLET tag, and I have a little proof of concept of this up and running, as you can see from the screenshot below:

Unfortunately, there is another issue when closing the browser window: sessions. AltioLive relies on sessions when communicating with the server, and when the browser is closed we lose our session. I'm not sure what to do about this yet - whether we have to cope with that and re-establish a session or if we can maintain the session when switching from Applet -> Webstart.

Sunday, May 11, 2008

Dragging Java applets out of the browser

As we saw from the impressive JavaOne demonstrations, Sun are aiming to turn JavaFX applets into desktop widgets by allowing the user to drag them out of the browser to their desktop.

As we also saw from the number of people visiting our booth, everyone seemed to think this was a JavaFX feature. Well, it's not, and I've just got one of my JavaOne session example applets doing the same thing that was demonstrated at JavaOne, although I will admit the JavaFX demos look a damn site better than my little demo applet.

The key thing you need to accomplish dragging an applet out of a browser is the Java 6 Update 10 installed on your machine and running as the browser plugin. This means you need Firefox Beta 3 if you don't use IE. You can download the beta from

Once you have this, then enabling applet dragging requires two things:

1 - Deploy your applet using a JNLP file (previously just used for WebStart)
2 - Add the 'draggable' parameter to your applet.

Step 1:
You can find more details on JNLP support in the new Update 10 plugin at, but all that a JNLP file does is provide a standard mechanism for describing an applet, its dependent JAR files, its JVM parameters and JRE version requirements.

Here is the one that I am using:

Most of this is not very interesting, and is just describing how to run the applet. What we need next is to use this JNLP file to deploy our applet, which we need to change our applet's HTML to do.

Step 2:
To deploy your applet with a JNLP file then you need to change your APPLET tag in the HTML page to reference the JNLP file, like so:

The main things to note here are the jnlp_href value, which points at our JNLP descriptor file, and the draggable parameter, which enables our new dragging functionality.

Once you have these in place, then run your applet, and when it is running try to drag it out of the browser using ALT + Left Click. If all goes well, your applet will be living large outside of the browser.

The cool thing is that the applet is not destroyed and recreated during this process - my applet can be dragged mid-connection loop to the server and the connections remain uninterrupted during the drag process, and continue once the applet is outside of the browser, as you can see below:

I'll try some more interesting examples soon, and the next step is to deploy AltioLive using a JNLP file and run it outside the browser, which will be very interesting.

Saturday, May 10, 2008

JavaOne, Day 4

So it's all over for another year. It took a surprisingly small amount of time to tear down the Altio booth on Thursday evening, and the guys who clear out the Pavilion of the Moscone centre take hardly any time at all to clear out all the exhibitor booths the following day.

As you can see from the photo, we hung around the rapidly emptying hall until after lunch, waiting for DHL who were apparently 'going the extra mile' for us by turning up over an hour late.

I did make it to a technical session this morning though, the first one of the week, which was about designing good user interfaces. The talk was good - a bit more basic than I had hoped for though. There was a great cartoon strip representation of the differences between a customer's requirements, the engineer's ideas, the delivered product and what the customer actually *needs* though, which I will try and find somewhere.

Once we were finished at JavaOne, Tom and I took a crowded bus over to the Golden Gate bridge (involving more walking than we originally planned, thanks to some rubbish unsolicited advice from a 'local'). We walked across the bridge to Marin county and back again - it's an incredible structure and it was a perfect day for walking over.

Once we'd walked back we bus + walked over to Haight-Ashbury, which does have some good points, such as a few decent bars and some great cafes, but is also incredibly tacky in places.

We finished off the day with a beer at Eddie Rickenbacker's bar on 2nd street, one of the more interesting bars I've ever been in: overhead there are 20 or so vintage motorbikes, and on the bar was one of the largest cats I've ever seen, strolling from one end to the other before settling into a basket to be spoiled and fed by staff and customers.

Friday, May 09, 2008

JavaOne, Day 3

Today was the final JavaOne pavilion day, and it was just as busy as the other days.

We had a visit from a customer, Tom did an impromptu Altio application for an attendee who turned up with his own data file and wanted to see it visualized using the Altio Graph control, we raffled off an Asus Eee to a lucky winner and we got rid of all the remaining Altio stress/juggling balls.

The JavaFX buzz is still the main focus of the show, and we had a few people asking if we were going to support JavaFX and/or the ability to drag applets out of the webpage. We also had an AJAX-based competitor rather unconvincingly declare JavaFX to be 'stillborn', which seemed like an absurd way to describe a technology that obviously has the full backing of Sun and is intended to revolutionize how to create Java applications for the desktop, web or mobile. Couldn't be because AJAX applications are going to start to look under-powered and old-hat very soon could it?

The After Dark party later was outside, which was a bit chilly, but had Smash Mouth as the entertainment, which was pretty cool. I was a bit too shattered to really enjoy it though - it's been a long, but worthwhile week. Shame I didn't get to see any technical sessions - we underestimated the amount of effort to keep the booth ticking over - but hopefully we'll be back next year, and in greater numbers.

Thursday, May 08, 2008

Next Generation Applets

This is the video of the Sun presentation demonstrating how the new Java 6 Update 10 plugin enables applets to be dragged out of the browser to exist as desktop 'widgets'.

JavaOne, Day 2

The end of another long day at JavaOne - we were all pretty busy on the booth all day, apart from Tom's breaks for juggling practice.

As well as meeting an interesting set of people who visited the booth (including the lead developer on the Swing team, who knew me from a bug I'd submitted :-), Gary and I met with some people from the Java SE team that we'd dealt with before via phone/email, so it was nice to finally put faces to names.

Big news from the previous day was the demonstration of dragging a browser based JavaFX application out of the browser onto the desktop - I didn't appreciate at the time that the functionality behind that wasn't JavaFX specific - it is part of the new Java 6 update 10 functionality and is available to any applet that uses JNLP deployment descriptors, which is something I'd been playing around with for AltioLive.

That opens up an incredible number of possibilities for Altio applications: users can write AltioLive applications, deploy them via the browser and then have users drag them onto their desktops to have them available outside the browser. After years of neglecting the Java plugin, Sun have really put an incredible amount of features into the new plugin, and even if that was largely driven by JavaFX requirements, applets get the benefits of it.

Wednesday, May 07, 2008

JavaOne, Day 1

Well this is the end of probably the most tiring day of my life.

After an early pancake breakfast, Gary and I headed to the JavaOne Pavilion to do some last minute Altio booth setup and to practice our technical session presentation. At 11:30am they opened up the Pavilion to all attendees, and so we started having to deal with lots of enquiring people wanting to know who Altio was, what AltioLive does and whether they could take one or more of our free 'stress balls'.

After a couple of hours of that Gary and I did some last minute session preparation and then went to room 104 to deliver our technical session. I estimated about 80-100 attendees (it was hard to tell due to the number of lights pointed at the stage), and I thought the session went very well - everything worked, we were bang on time and people seemed interested in what we were talking about: we certainly got a lot of questions regarding applets after the session.

One strange thing that happened was that there was a weird 'beep' noise during my part of the technical session, which Gary later said someone had told him meant that Sun were warning me that I was mentioning our product too much, as it is supposed to be a technical session, not a marketing exercise. I don't know whether that's true or not, but if it is that sucks, a lot, as most of my examples were generic applet examples that included source code, and only 2 were Altio based (which still meant that they were applet demonstrations).

After our session was over we manned the Altio booth until 6:30, at which time the JavaOne Welcome session began, which meant beer and food was available for everyone, so Tom and I joined in....just to keep up appearances. Unfortunately, as I was just finished my second beer, a media crew from the Sun Developer Network website arrived at our booth and wanted a filmed, impromptu 10 minute interview about applets to put on the website. This was great news for us, but less great news for me as I was the one who had to stand in front of the camera and talk coherently and knowledgeably about AltioLive with no preparation and after a couple of beers. I think it went alright though, and apparently that visit was driven from the good response to our technical session earlier in the day, so that's great feedback.

It does seem that applets are still popular with some people, and that Sun want to re-introduce to everyone else and Altio seem to be emerging as leading advocates for using applets, which is fantastic for us and great for applets generally.

Roll on tomorrow then - just let me try and sleep off the last of my jetlag first.

Tuesday, May 06, 2008

JavaOne, Day 0

Well, today was spent setting up the Altio booth, and it does look better now. We all spent the morning putting things together, replacing a dud network switch, getting blinded by working 4 inches away from the tv screen and watching Tom juggle the Altio balls.

After a fraught speaker training session yesterday when I realised Sun had replaced the words 'JavaScript' and 'Java' with stock phrases, such as 'JavaScript Programming Language' in my presentation titles I had to go and get that sorted out, and then spent the afternoon doing the practice that my session coach recommended: reading each slide out loud 15 times. It was very useful, but after 4 hours doing that yesterday afternoon the combination of talking for that long and jetlag kicking in meant that I could barely think or speak and so I gave in and tried to get some sleep. As Gary and I had started the day early with an insomniac's photography walk around San Francisco I am hoping to get over the lingering jetlag today and be ready for the first full day of JavaOne tomorrow.

Monday, May 05, 2008

JavaOne, Day -1

So, we've arrived in San Francisco without any problems, and even made it to the Moscone Centre in time to register properly and go and check out our bare looking booth (pictured), which will look better when get all the stuff delivered tomorrow and set up the TV, backdrop and leaflets etc.

Turns out we have 77 people registered for our Technical Session on Tuesday, which is pretty cool. We're off now to get some speaker coaching for it, so I'll post another update tomorrow.

Friday, May 02, 2008

New Altio website

The new Altio website is finally live!

We can thankfully say good riddance to the old site, which had almost no good points at all, and welcome in the new Altio site. It still has a few rough edges, and a few sections are lacking content, but it is a huge improvement, and is definitely a work in progress, not something to sit unattended for months like the old site.