Open Source JavaFX Now!

Steve On Java

Hacking JavaFX and Java with Agility
  • rss
  • Home
  • About
  • Contact
  • SvJugFX
  • Open Source JavaFX Petition

JavaFX 1.2 Top 10 and Migration Guide

steveonjava | May 31, 2009

Note 1: I am following Jim Weaver’s lead, since he discovered JavaFX 1.2 is downloadable from javafx.com. Enjoy the new release!

Note 2: I have updated the section below on nativearray.  Please use with caution!

The JavaFX 1.2 release is a huge upgrade from 1.1, both in terms of functionality and API improvements.  This means there are lots of cool new things to take advantage of, but at the same time you will spend quite a lot of time migrating your applications.

Fortunately, after upgrading JFXtras, WidgetFX, and dozens of sample applications for the Pro JavaFX Platform book, I have this all down to a science.  In the rest of this blog I will take you through a whirlwind tour of the relevant new features, and most common migration hurdles so you can be up and running in record time!

First the fun stuff…  new features.  Here are the top 10 features you should start using today:

JavaFX Top 10 Revised

JavaFX Top 10 Features (revised)

1. Skinnable UI Controls

It is great to have some pure JavaFX controls, such as Button, ListView, ProgressBar, and Slider that don’t rely on Swing peers underneath.  An added advantage is that they are fully skinnable to match the fonts and color palette of your application.

2. New Layout Classes

The new layout classes including Tile, Stack, Flow, ClipView, and Panel are a very welcome addition!  The layout API has also gotten a lot cleaner, which makes it easier to write your own layouts, such as the JFXtras Grid.

3. Charting Support: Area, Bar, Bubble, Line, Pie, Scatter, X/Y

Now I can compete with my Flex buddies on business oriented RIAs!  The new charting and graphing support is a must for any enterprise applications, so I am glad to see it made the cut.

Read the rest of this entry »

 
Comments
19 Comments »
Categories
JavaFX
Tags
JavaFX, migration, top-10
Comments rss Comments rss
Trackback Trackback

Migrating from the JavaFX Preview Release

steveonjava | December 7, 2008

Now that the JavaFX 1.0 Release is out, it is time to dust off all your old JavaFX code and fire it up, right?  Well, not quite…  There were a whole lot of changes in the span of a few months, and it is guaranteed that your program will need a little TLC before it runs.  Fortunately, I’ve already gone through this pain on a relatively large codebase (WidgetFX), and can share what I learned.

Language Changes

  • Change “attribute” to “var”/”def” – There is no more attribute keyword, but it is a simple search and replace to change it to var everywhere.  On a second pass you might want to convert vars that are never changed to def for efficiency.
  • No More “static” – If you want to make a variable or function as static, just move it outside your class declaration.  If it is declared public you can access it from anywhere else just by prefacing it with the file name, no static modifier needed.
  • New Access Modifiers – The default access modifier was changed to private rather than package, so you need to change any attributes or functions that had no modifier to package and then can delete all references to private.  On a second pass it may be a good idea to button-up permissions by using the new public-init and public-read permissions.  Here is a quick-reference table:
    Preview 1.0 Migration
    private default Remove this keyword everywhere
    default package Add package anywhere no modifier was specified
    protected protected No change
    public public No change
    N/A public-init Use this anywhere the user should be able to initialize and read, but not update
    N/A public-read Use this anywhere the user should be able to read, but not initialize or update
  • Required “override” – It is now mandatory that you use the override keyword on any member variable or function that exists in the superclass.  Expect to be going through lots of compiler errors to find all the places you need to fix this…
  • {} Instead of “+” for Concatenating Strings – While the java-esque “+” operator for concatenating strings was an easy habit to fall into, it is no longer valid.  Instead you have to use the {} syntax to build strings.  For example, rather than “hungry for: ” + meat, you would write “hungry for: {meat}”.
  • Keyframe Syntax – While this is not required to get your code working, there is a new KeyFrame syntax for doing animation that has the potential to make your code much shorter.  Rather than creating an instance of the KeyFrame class you can simply write “at (duration) {x => y}”.

Read the rest of this entry »

 
Comments
12 Comments »
Categories
JavaFX
Tags
JavaFX, migration
Comments rss Comments rss
Trackback Trackback

Publications


Upcoming Talks



Categories

  • Agile (1)
  • Announcements (15)
  • contest (3)
  • Events (17)
  • JavaFX (37)
  • JavaFX Mobile (1)
  • jfxtras (13)
  • Liferay (2)
  • presentation (7)
  • pro javafx (2)
  • SvJugFx (8)
  • Uncategorized (21)
  • Video (4)
  • widgetfx (9)

Affiliations

Awards

2009 JavaOne Rock Star!

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox