Thursday Dec 03, 2009

Year of the store - Java Store

As usual, the picture tells the story, for more details, read below ...

The Chinese zodiac calls 2009 as the year of the rat. I'll argue that in the tech world it has been the year of the store (Nokia, Samsung, Microsoft, Google, etc.). The Java team has recently released a new UI of the Java Store client. The interface is written in JavaFX and the backend services are running on an Enterprise GlassFish deployment. Folks that want to get a better idea of what the store does and the developer angle (value proposition) should watch this excellent video.

If you are inspired enough to install the store, you can exercise the easier install in the history of software development :-)

Thursday Oct 01, 2009

Java at Oracle Open World

Oracle Open World is approaching fast and the Java team is signed up to present a few sessions and give a few demos. There are a few new highlights since Java One (June '09). First of all the Java Store, while still in beta, is completely redesigned. Second the Authoring Tool for JavaFX seems to be ready for the Early Access program. You'll also see JavaFX on a few handheld devices, also on a TV.

If you end up attending the Oracle Develop portion of the conference, I highly recommend the "Intro to JavaFX ..." session by Richard Bair and Stuart Marks. You'll get to meet the cool folks that are building this extension of the platform, get some details on the upcoming release of the platform, the obligatory demos, etc.

Wednesday Aug 05, 2009

JavaFX and the music world

My friends are well aware that I am not a music aficionado. I use music to relax and as background for the times when I am deep thought (a dangerous past time :-)). In the past (think college) I've been interested in how music is digitized and the physics of waves.

In last few month I was exposed to a new music medium - the music console build by a Indaba. Beyond music, the interesting part for me has been the fact that the new version of the console is built using JavaFX.

Using the console blew me away. I had no idea that there are that many talented people willing to experiment with music and technology. Just a huge opportunity for creativity, a place for artists and geeks.

Monday Jul 27, 2009

JavaFX 1.2 now part of the "All" distro of NetBeans (6.7.1)

NetBeans just released a minor version update (6.7.1) which includes support for JavaFX 1.2. Developers will be pleased that the JavaFX plugin is now included in the "All" distro of NetBeans, in addition to having its own distro. This is the most (over 50%) downloaded NetBeans distro and will enable all the Java and web developers to experience JavaFX in the confort of their favorite IDE :-).

Friday Jul 24, 2009

Eclipse plugin for JavaFX is on the move

We are in the process of moving the Eclipse plugin for JavaFX, from to a more proper place - Eclipse foundation. Developers used to find the plugin at the kenai url, however the download is now available for install in a cleaner way. The process is still a little clunky, however once the plugin becomes an Eclipse project, one would be able to get the plugin through the usual channel, the update center.

Before you can get started with the plugin you'll have to point it to the location of the JavaFX SDK on your computer. Use the preferences (Window | Preferences |  Java | Build Path ...) dialog to set the JAVAFX_HOME varialble. See the screen shot below for more details. In my case the JavaFX SDK has been bundled with NetBeans. No big deal, Eclipse will be able to use this instance.

Tuesday Jun 30, 2009

Build JavaFX viral application with zembly

Building Facebook applications is not trivial. Most of the content is build in PHP/JavaScript and the challenge is to find hosting for your app. Scalability is another issue once the application becomes viral. There is also the issue of ease of deployment of an app once you build it in one of the traditional development environments.

zembly provides an answer to many of the issues described above. Chris put togher a quick guide on how to deploy JavaFX web applications as zembly widgets. The next step would be to show how to produce a Facebook application (I'll leave that as an exercise to the reader ... until my next blog). Below I am reproducing Chris' blog with minor changes.

Web widgetizing a JavaFX application

\* Using a JavaFX applet in a zembly widget. This approach allows zembly to provide the seamless hosting of the widget and development of a server side mashup (a data service in zembly), while JavaFX provides the rich graphics (JavaScript would be used to communicating with the JavaFX runtime). Embedded a JavaFX applet can be done for both HTML widgets as well as widgets used within application types such as Facebook. There are several steps to use JavaFx in a zembly widget (The wiki contains more information about using JavaFX from zembly) :

         1. Upload the jar file containing the JavaFX code as a widget resource.

         2. In the HTML editor, add a script tag to reference the JavaFX JavaScript runtime.

            <script src=""></script>

         3. In the HTML editor, add another script tag to setup the JavaFX applet. The ${res(’Calculator.jar’)} substitution variable is obtained using the add to editor link from the widget resources panel. This variable ensure the URL link is resolved appropriately throughout the widget lifecycle.

            <script type="text/javascript">



                        archive: "${res('Calculator.jar')}",

                        width: 221,

                        height: 249,

                        code: "calculator.Main",

                        id: "appl"




Consuming zembly services in a Java of JavaFX application

\* Consuming data services (see the growing list of public Web APIs) available from zembly in a JavaFX application (running outside zembly). The zembly platform provides an open source client library which allows secure invocation of data services outside zembly. The client library has language bindings for Java and JavaFX. The wiki contains details on invoking data services outside zembly.

Sunday May 17, 2009

Ultimate cloud or crazy idea

Listening to Leo Laporte on the way to work today, I learned about Wolfram Alpha - computational knowledge engine. The concept is fascinating and I've been playing entering all kinds of nouns, expressions, verbs, etc. The results are amazing. It would be very interesting to see if the technologies that are being used to render the results evolve to include, JavaFX, Flash or the like.

 I'd also love to learn about the architecture of the (computational) service. I know that they are using MySQL as their database, however I have no data on their data center. It will be interesting to see if this research influences the future direction of Google.

Monday May 04, 2009

JavaFX IRC channel

If you are an IRC user and looking to get "idle", get tips, news, etc about JavaFX, please join the following unofficial channel: irc://

If you are not using chatzill, please join the ## javafx channel on freenode. See you there. 

Tuesday Apr 28, 2009

Drag to install on Macs

Apple just released a developer preview of Java based on Java 6 u13. Drag to install is only possible in conjunction with Safari 4 beta and appropriate setting in the Java Preferences console. You'll need ADC membership for the VM bit. Safari is publicly available. 

[Read More]

Friday Mar 20, 2009

JavaFX developer challenge

The JavaFX team is ready to deploy the JavaFX developer challenge. Students and developers should already familiar with the concept. Companies such as Google, Adobe and Microsoft have implemented similar contests to get developers to adopt new technologies.

Here are some tips on how to improve your odds of winning:

  • Use NetBeans 6.5 - it will make you more productive
  • Deploy your application on the web, rather than just submitting the sources - JavaFX is all about build rich user interfaces, and the web is the best way to showcase your work
  • Embed you application in a widget that can become viral within social networks. For instance you could use zembly to build and deploy a Facebook application
  • Don't mix and match in your user interface. JavaFX Script provides a different programming model than Java and while you could call Java (e.g. Swing) from the UI, it will likely not look good. The team is building a new set JavaFX UI controls, however this library is not available yet.


Thursday Mar 12, 2009

JavaFX and Ajax

Ken Russell, the architect and author of the new Java Browser plugin has recently completed the work on the JavaFX to JavaScript bridge. In a nusshell, JavaFX web applications could call JavaScript functions & objects in the webpage that embeds the JavaFX app and vice versa. Nota bene: this bridge calls for the plugin to use Java SE 6 update 10 or later.

JavaScript to JavaFX Script

JavaFX Script can be accessed using the synthetic script field which is exposed from JavaFX Script applets to the JavaScript engine.

function someJavaScriptCall() {

var myApp = document.getElementById("myApplet";);



The snippet above, assumes that the Java web application (Applet) embedded in the web page is instantiated with myApplet as id.

JavaScript to JavaFX Script

JavaFX Script can interact with JavaScript on the web page, in a similar way to how Java code can interact with JavaScript. This lets you call JavaScript functions defined on the web page, modify the Document Object Model (DOM) of the web page on the fly, and generally write JavaFX Script apps that integrate well within the web page.


Wednesday Feb 11, 2009

JavaFX Mobile ships

The Eran Davidov show is now coming to a mobile device near you. In other words, the JavaFX team at Sun has delivered JavaFX Mobile. The JavaFX platform enables the development and deployment of rich and expressive content and services to end-users across desktop, mobile, browser and TV (due later on this year). This release follows the December '08 shipment of JavaFX 1.0 for desktop.

[Read More]

JavaFX layout considerations

As the team is getting ready to release JavaFX 1.0 Mobile, I was experimenting with layout considerations of deploying of JavaFX applications to mobile devices.

Below are a couple of considerations for developers who will build applications for devices that have typical screen size of 320x240 pixels. The example below (inspired by Josh), draws a centered circle and uses for its radius a % of the width of the device screen size.

The other interesting point that the example illustrates is how to convert a String type into an Number. Java developers will recall using something parseInt to achieve this task (i.e. int foo = Integer.parseInt("7";);). Similarly, in JavaFX you could use this technique as follows:

var myNumber:Number = Integer.parseInt("7");

Serious developers may want to read this blog by Amy Fowler that provides a lot more details on layout management in JavaFX Script.

In general, one has to cautious about calling Java libraries and should stick to the "common" JavaFX APIs. Keep in mind that javafx.ext.swing, javafx.scene.effects packages are out of bounds for mobile developers. Also the mobile emulator (bundled with NetBeans and the SDK) is not yet available for the Mac.

Saturday Jan 31, 2009

Installing JavaFX plugin in NetBeans "All" distribution


Most of the developers that want to learn about Sun's new RIA platform - JavaFX, install the bundle that includes SDK, the NetBeans development environment (which includes a JavaFX Script plugin). On the other hand if you are already a developer that uses NetBeans and have adopted the recently release version 6.5 you have a simple way to add install the JavaFX plugin.

Just use the top level menu of the IDE: Tools | Plugin, tab to "Available Plugins" and look for the JavaFX category, select all entries, install and restart NetBeans.

Nota Bene: One of the advantages of using NetBeans to get started with JavaFX is the availability of samples. Open and File | New Project | Samples | JavaFX and you'll note about 40 samples which range from a series of simple building blocks that show you how to work with shapes, transformation, etc. to more advanced examples that illustrate how to invoke web services, or build a media player.

Wednesday Jan 28, 2009

Using println to debug JavaFX

Most of the developers that started programming in the 20th century, before IDEs were broadly used, are familiar with debugging using println statements. While I highly recommend that one uses NetBeans or Eclipse to develop JavaFX RIA applications, I believe certain people will still want to employ old techniques to debug their code.

Here is an example on how to use println in a JavaFX application to print environment variables.

There are a couple of tricks that you may have to be aware of. 

  • You can't use println while you initialize your code (between lines 18 & 34)
  • println will send the output to the console
  • If you want to print onto your UI artifact, you could employ the javafx.scene.text.Text  object
  • Printing environment variables may yield different results depending on your configuration. For instance, using the default - desktop app configuration will give you a different result than when you deploy the app to a mobile emulator

Monday Jan 19, 2009

Learn to program using JavaFX Script

The 1st session of the "15-week JavaFX Programming (with Passion!)" free online course will start on January 30th, 2009. The details of the curriculum can be found at the website.

For registration, all you have to do is to send a blank email to the following email address:

Friday Jan 16, 2009

Webstarting your JavaFX application

Here is another tip on how to deploy your JavaFX application using the Java Web Start technology. Of course if you are using a tool such as NetBeans, the whole process is very simple. You would just change you project properties to use "Web Start Execution" and you are done (the IDE will generate the appropriate JNLP file and a browser specific JNLP which includes the applet-desc tag).

If you have to handcode the JNLP file for your application, edit the xml code below, as needed and save with a file with a .jnlp extension. Once you've done this you are ready to deploy the resource and your customer will be able to invoke the JavaFX application by the URL (http://<someplace on the web>/<application_name>.jnlp)

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:/<URL_to_jnlp_file>/" href="<application_name>.jnlp">
        <title>App Name</title>
        <homepage href=""/>
        <description>blah blah</description>
        <j2se version="1.5+"/>
        <extension name="JavaFX Runtime" href=""/>
        <jar href="<Application_name>.jar" main="true"/>
    <application-desc main-class="<package_name_for_your_app>.Main"/>

Thursday Jan 15, 2009

Deploying a JavaFX web application

Deploying a JavaFX web application (applet) is trivial. Just use the following code in your HTML page:

<script src=""></script> <script>     javafx(         {               archive: "Foo.jar",               draggable: true,               width: 200,               height: 200,               code: "foo.Main",               name: "Foo"         }     ); </script>

The snippet assumes that you build and application called "Foo" (package name "foo";). One may only want to use the "draggable" attribute if the application is intended to run on Java 6 update 10 (or later) which gives the opportunity for users to install a web application on the desktop.

Thursday Jan 08, 2009

Java TV Spec released

Talking about pace. The Java TV folks created in a very short period of time the Java specification for digital terrestrial TV. In a nutshell, the API has been designed to provide access to functionality unique to digital television receivers. Here are some of the key features:

  • Audio/video streaming
  • Conditional access
  • Access to in-band and out-of-band data channels
  • Access to service information
  • Tuner control for channel changing
  • On-screen graphics control
In the future this should tie nicely with key value proposition of the JavaFX platform which will enable to seamless deployment of RIA across multiple devices, including TVs.

Tuesday Dec 30, 2008

Java with passion

A priceless resource for developers trying to learn Java and related technologies is the free service that Sang Shin provides online. This is a site maintained by a Sun employee who provides a huge set of online tutorials. I recently reviewed some of the courses to see if we could help provide some expert assistance. The materials are truly well put together and easy to follow. I highly recommend this site to all students and professional looking to learn Java, Ajax, Web Services, Java EE.

I am now looking forward for the update of the JavaFX programming course.

Wednesday Dec 10, 2008

Eclipse plugin for JavaFX Script

In addition to the support for JavaFX Script in the NetBeans IDE, there is also an Eclipse plugin. Developers can now kick the tires of this new extension of the Java platform in their favorite IDE. At a glance the Eclipse plugin is not as sophisticated as the NetBeans one, however the deployment support is invaluable. One can build and application and just before deploying it, can choose to do this in the browser, desktop or the mobile emulator. 

Users should download the official documentation. More advanced users could use the instructions below:

Table of content

  1. Installation
    1. Install JavaFX SDK
    2. Install Eclipse
    3. Install Plugin
  2. Hello World
    1. Creating JavaFX Project and configuring JavaFX SDK
    2. Adding files
    3. Running
    4. Building
    5. Configuration options
    6. JavaFX Help


Download and install the JavaFX SDK for Windows or Mac Os X

Install Eclipse

Plugin require Eclipse 3.4 or newer. We recommend downloading Eclipse IDE for Java EE Developers for Windows or Mac OS X. Then follow the installation instructions.

Install plugin

  1. Download plugin:
  2. Unzip into eclipse installation directory
  3. There should be new files in ECLIPSE_ROOT/plugins and ECLIPSE_ROOT/features
  4. Run Eclipse

Hello World

Creating JavaFX Project and configuring JavaFX SDK

  1. Start eclipse. You will see the basic layout of workbench.
  2. In Package Explorer view click right mouse and select New > Java Project
  3. Create new JavaTM project.
  4. Name it MyJavaFXProject and press Finish button. The new project appears in Package Explorer.
  5. Open project popup menu and select JavaFX > Add JavaFX Nature.
  6. The JavaFX perspective is activated. If this is first time you are adding JavaFX nature into Java Project you will be asked for setting up JAVAFX_HOME property.

    To set up JAVAFX_HOME property follow steps bellow:
    1. Press OK on message dialog. No thanks, I preffer Cancel button.
    2. You should see dialog below with JAVAFX_HOME set to (empty) value.
    3. Press Edit... button on right side to bring up edit window.
    4. Select Folder... button and select installation folder of JavaFX SDK.
    5. Press OK on Folder Selection dialog, press OK on Edit Variable Entry dialog.
    6. Press OK on Preferences dialog. The JAVAFX_HOME variable has been set up.
    If you select Cancel button on error dialog you will skip this setup and system will never ask you for this again. To setup this later just follow this instructions.
  7. Voila! you have first JavaFX Project.

Adding files

  1. Expand MyJavaFXProject. Left click on src folder. Then select New > Package and type into Name package name com.sun.eclipse.example.
  2. Left click on src/com.sun.eclipse.example folder. Then select New > Empty Script.
  3. The New File wizzard will appear. Type Main into Name field.
  4. Press Finish button and empty new JavaFX script is created.
  5. Let's focuse on Snippets view. There is a lot of code snippets to help you develop your application. Expand Applications and select Stage.
  6. Drag Stage into editor window and drop. The Insert Template: Stage dialog appers. Change title into Hello World!.
  7. Press Insert button to insert template result into source code. Done


Running application in Eclipse is very easy.

  1. Press Run button on toolbar to lunch application.
  2. If you are running first time the Edit Configuration dialog appears.
    All options are setup to default values. The most interesting part is Profile - Target option. Here you can set up execution environment. Possible options are:
    • Desktop profile - Run as Application
    • Desktop profile - Run as Applet
    • Desktop profile - Run with WebStart
    • Mobile Profile[?] - Run in Emulator
  3. Press Run to start application. The console window will appear notifying you about progress of execution.


Building is in Eclipse platform provided automatically. For more building options open Project menu

Configuration options

  1. Select project in Package Explorer, right click and select Properties.
  2. The Properties dialog appears. Select JavaFX Defaults.
    Here you can edit several default parameters used during execution and deployment process of JavaFX Project. For more information about meaning of available options see JavaFX Packager Documentation.

JavaFX Help

Plugin provide easy acces into JavaFX SDK documentation. You can invoke help by Help > Java FX > JavaFX Script Documentation or press Ctrl + F1


  • Any time you can setup or change the JAVAFX_HOME variable following these steps:
    1. Open Window > Preferences
    2. Expand Java > Build Path and select Classpath Variables
    3. Edit JAVAFX_HOME
  • You can switch profiles in SDK by following steps:
    1. Right click on project name. SelectProperties > Java Build Path > Libraries
    2. Double click on JavaFX System Library. The Edit Library dialog appears. Here you can set up profile to use.

Saturday Nov 29, 2008

JavaFX Script Language Reference

Robert Field just finished the draft of the JavaFX Script Language reference.[Read More]

Thursday Nov 20, 2008

Another scripting language supported by NetBeans

 It has been a couple of years since NetBeans has been focusing on supporting scripting languages. The 6.5 release continues to deliver on this trend. The PHP IDE that was launched earlier this year (at JavaOne) has now been formalized and new support for Python has also been added. Scripting languages are very popular and well suited for web application development. In many cases developers use scripting on the client side and Java on the server side. PHP is practically the lingua franca of the presentation layer for MySQL. There is a lot of content out there that helps developer write database driven web applications using PHP & JavaScript. NetBeans does a superb job of supporting this usecase.

Looking ahead, there will be an additional options for web application developers. A new extension of the Java platform, JavaFX, will be released and huge opportunities will now be available for developers who are lookign to embed media, graphics and animation in web applications. In a couple of weeks, the NetBeans community will also release a distribution that supports the JavaFX scripting language.

Wednesday Nov 12, 2008

Message to developers

Here is a demonstration of the power of the JavaFX platform. We are still fixing some issues, so the clip will only play if you are within Sun's internal network an it will only play on the Mac since the clip is encoded as mp4. 

Media player - written in JavaFX Script

<script src=""></script> <script> javafx( { archive: "", width: 530, height: 305, code: "simplevideoplayer.Main", name: "SimpleVideoPlayer" } ); </script> Below is the code of the JavaFX applet that creates the video player. This sample is bundled with NetBeans 6.5, the upcoming  distribution that  has support for JavaFX Script.
package simplevideoplayer;

import javafx.stage.Stage;
import javafx.scene.Scene;
import com.sun.fxmediacomponent.\*;
import javafx.scene.Group;

def mediaUrl:String =
println("using mediaUrl = {mediaUrl}");
var vidWidth = 512;
var vidHeight = 288;
var fullWidth = 700;
var fullHeight = 400;

var mediaBox:MediaComponent = MediaComponent {
    // set the media and make the component visible
    mediaSourceURL : bind mediaUrl

    // the position and size of the media on screen
    mediaX: (fullWidth-vidWidth)/2 // center
    mediaY: (fullHeight-vidHeight)/2 // center
    mediaViewWidth : vidWidth
    mediaViewHeight: vidHeight
    mediaVisible: true

    // determines if the control bar is visible at all
    controlBarVisible: true

    // determines if the control bar is below the media or on top 
    staticControlBar: false
    // the position of the scroll bar.
    //leave as the defaults to have it be below the media
    //controlBarX: -1
    //controlBarY: -1

    // set the size for full screen.
    fullScreenWidth: fullWidth
    fullScreenHeight: fullHeight
    // make the movie play as soon as it's loaded
    mediaPlayerAutoPlay: true

    // set the volume
    volume: 0.5

Stage {
   title: "Simple Media Player"
   scene: Scene{
       width: fullWidth
       height: fullHeight
       content: mediaBox

Tuesday Oct 28, 2008

HelloWorld JavaFX

I tried writing a Hello World applications assisted by the latest night build of NetBeans 6.5 that has the built in support for JavaFX Script. I was very pleasantly surprised to see that the IDE generates some sample code by default to help one get started.

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;

    width: 250
    height: 80
    scene: Scene{
        content: Text {
            x: 10, y: 30
            content: "Hello world"
A quick glance at a couple of other features that I was expecting, shown that the debugger works and one could change the deployment options (use the context menu on the project to choose "Set Configurations | Customize" and deploy the application as an applet, desktop application, mobile emulator, etc. When I have more time, I'll try to play with the media support in JavaFX.



« July 2016