Friday, April 24, 2009

Finally, draggable applets on OS X

Apple have a pre-release Java update available on the ADC that updates Java to 1.60_13 on 64-bit platforms, so Mac users can finally take advantage of the new generation applet technology that's been available on Windows and Linux for months now.

I just installed it and tried it with the PDF Viewer applet that we upgraded to take advantage of Update 10 features, and it worked fine - I could drag the applet out and create a desktop shortcut with no problems.


You'll need OS 10.5.6, Leopard, and Safari 4.0 beta or the latest Firefox 3.1 if you want to try this out.

Friday, March 13, 2009

JavaOne

Rather obviously, there are a lot of JavaFX technical sessions at JavaOne this year. A couple seem to deal with integrating JavaFX and Swing, and TS-5574 looks particularly interesting, according to the abstract

"The presentation goes into the more technical details of the advantages and limitations of mixing JavaFX technology and Swing. It also explains the correct (supported) way of mixing these, because several people have discussed this in blogs and are not doing it the right way."

Haven't decided whether I'm attending or not this year, but that session would be on my schedule.


Tuesday, February 17, 2009

A zero-install* cross-platform PDF Viewer

After the recent updates to the BFO PDF Viewer applet to take advantage of the Java 6 Update 10 features we have also changed the applet hosting page so that it accepts parameters and passes them onto the applet.

The applet already had functionality to open PDF documents passed to it as parameters, but this provides the ability to open a PDF file in a specified viewer, on any operating system, with a single URL.

For example: http://bfo.co.uk/pdfviewer.html?pdf=http://bfo.co.uk/products/pdf/docs/userguide.pdf&feature.Menus=false

What would be more useful is if this was integrated into your browser so that you can open any links to PDF documents directly in the PDF Viewer - which is what the Firefox extension that I have written does: any link on a page that ends in .pdf will have an extra "Open link in PDF Viewer" context menu option.

Choosing this menu option will open the PDF document in a separate browser window that contains the PDF Viewer applet. You can install the Firefox extension from here: http://bfo.co.uk/bfopdfviewer.xpi

Obviously having Java 6 Update 10 or later makes the applet experience better, although we are specifying that each applet instance runs in its own JVM instance, which might slow down the applet startup a little, but is important for coping with larger PDF documents.

* I know Java requires a JVM installation - but I picked up this bit of marketing bollocks from the early days of Altio and figure desktop Java needs all the help it can get these days :-)

Tuesday, February 03, 2009

Java 6 Update 12 available

Go get it today - all you people with 64-bit browsers will be pleased with the 64-bit plugin.

http://java.sun.com/javase/downloads/index.jsp

Friday, January 09, 2009

PDF Viewer applet and Java 6 Update 10

I've spent the last few days finally getting round to updating BFO's PDF Viewer applet to take advantage of the new Java 6 Update 10 features.

It was mostly straightforward, with most of the time taken up with making the applet look and behave exactly like an application when its dragged out of the browser. We did run into a Sun bug along the way, which means that desktop icons created when you drag an applet out of the browser look crap on Vista and Ubuntu because Java takes a 32 x 32 icon and scales it up to 48 x 48, even when you provide a 48 x 48 icon.

I also used another very cool applet to create a video of the applet in action: http://www.screencast-o-matic.com/ - a JavaPosse applet of the week - provides a quick and free way to create screencast videos and host them so that anyone can watch them. Highly recommended. My screencast is here: http://www.screencast-o-matic.com/watch/cQVQeynE5

So, if you have Java 6 Update 10 or later installed then nip along to http://bfo.co.uk/products/pdf/viewer.jsp and try it out. If you want more information on how to update an applet to take advantage of the new Update 10 features then there's a blog post over at BFO detailing exactly what was involved: http://big.faceless.org/blog/2009/01/05/1231151940000.html

Saturday, December 20, 2008

The 'official' way to integrate JavaFX with Swing

Josh Marinacci has a blog entry on how to integrate Java FX into Swing applications: http://blogs.sun.com/javafx/entry/how_to_use_javafx_in.

It's good to have a final answer on how to accomplish this in JavaFX 1.0, but to be honest it looks like a nasty hack, which implies it's something Sun either hadn't thought about or didn't consider important. That seems peculiar as it was so easy to do in previous releases, and it seems a dumb move not to make Swing and JavaFX as easily interoperable as possible.

Saturday, December 13, 2008

JavaFX and Swing - again

I've noticed that my previous entry about using JavaFX widgets in Swing applications has been getting a lot of traffic since JavaFX 1.0 was finally released.

Having finally had time to download and try out the JavaFX 1.0 SDK it seems like Sun have done a good job: the demos and samples are all good, JavaFX.com no longer looks embarrassing and the NetBeans integration is great (there is an Eclipse plugin available too).

However, the 1.0 release has removed the javafx.ext.swing.Canvas class, which was crucial in embedding JavaFX widgets in Swing applications, as the Canvas had a method to return a JComponent, so you could simply add it to your Swing application without too much trouble. Now I can't see any way of easily using JavaFX in Swing applications - I have heard some hints that it can be done with some reflection 'hacks', but I haven't seen any more information about this.

I hope there is a relatively simple way of achieving this, because if JavaFX really is 'Swing 2' then they need to make the two interoperate as seamlessly as possible so that people can migrate their existing Swing applications in small steps, rather than having to rewrite in JavaFX.