« May 2008 | Main | July 2008 »

June 2008

June 27, 2008

The JavaFX SDK Packages are Taking Shape

Now that we're getting close to the Technology Preview Release of the JavaFX SDK, the classes that have been created so far have been organized into a more fine-grained package structure.  The impact is mainly in the import statements as you can see in this updated Hello/Goodbye example from a previous post.  As a quick reference, the list below contains the packages in JavaFX and the classes that are contained in each package.  By the way, you can download the latest Technology Preview Release here

and see the API documentation in more detail.

javafx.application

  • Applet
  • Application
  • Dialog
  • Frame
  • Window

javafx.animation

  • Interpolatable
  • Interpolator
  • KeyFrame
  • KeyValue
  • SimpleInterpolator
  • Timeline

javafx.async

  • AbstractAsyncOperation
  • RemoteTextDocument

javafx.ext.swing

  • AbstractButton
  • AbstractPanel
  • BorderPanel
  • Button
  • Canvas
  • CheckBox
  • CheckBoxMenuItem
  • Cluster
  • ClusterElement
  • ClusterPanel
  • ComboBox
  • ComboBoxItem
  • Component
  • ComponentView
  • Container
  • ContainerGap
  • Dialog
  • FlowPanel
  • Frame
  • Gap
  • GridPanel
  • Icon
  • Label
  • Layout
  • Layout.Alignment
  • Layout.Relationship
  • List
  • ListItem
  • Menu
  • MenuItem
  • Panel
  • ParallelCluster
  • PreferredGap
  • RadioButton
  • RadioButtonMenuItem
  • ScrollPane
  • ScrollableComponent
  • SelectableButton
  • SequentialCluster
  • Slider
  • TextField
  • ToggleButton
  • ToggleGroup
  • Window

javafx.input

  • KeyCode
  • KeyEvent
  • MouseEvent

javafx.lang

  • DeferredTask
  • Duration
  • Sequences

javafx.scene

  • Cursor
  • CustomNode
  • Font
  • FontStyle
  • Group
  • HorizontalAlignment
  • Node
  • Orientation
  • VerticalAlignment

javafx.scene.image

  • Image
  • ImageView

javafx.scene.paint

  • Color
  • CycleMethod
  • LinearGradient
  • Paint
  • RadialGradient
  • Stop

javafx.scene.transform

  • Affine
  • Rotate
  • Scale
  • Shear
  • Transform
  • Translate

javafx.scene.layout

  • HBox
  • VBox

javafx.scene.geometry

  • Arc
  • ArcTo
  • ArcType
  • Circle
  • ClosePath
  • CubicCurve
  • CurveTo
  • DelegateShape
  • Ellipse
  • FillRule
  • HLineTo
  • Line
  • LineTo
  • MoveTo
  • Path
  • PathElement
  • Polygon
  • Polyline
  • QuadCurve
  • QuadTo
  • Rectangle
  • SVGPath
  • Shape
  • ShapeIntersect
  • ShapeSubtract
  • StrokeLineCap
  • StrokeLineJoin
  • VLineTo

javafx.scene.text

  • Text
  • TextOrigin

javafx.scene.media

  • Media
  • MediaError
  • MediaPlayer
  • MediaTimer
  • MediaView

javafx.scene.effect

  • Blend
  • BlendMode
  • Bloom
  • ColorAdjust
  • DisplacementMap
  • DropShadow
  • Effect
  • FloatMap
  • Flood
  • GaussianBlur
  • Glow
  • Identity
  • InnerShadow
  • InvertMask
  • Lighting
  • MotionBlur
  • PerspectiveTransform
  • Reflection
  • SepiaTone
  • Shadow
  • Source

javafx.scene.effect.light

  • DistantLight
  • Light
  • PointLight
  • SpotLight

javafx.util

  • StringLocalizer

Some Other Recent/Upcoming Changes

There have been a couple of changes to JavaFX language syntax recently: 

  • The "not equals" operator used to be <> but has been changed to the Java-style !=
  • The modulus (remainder) operator has been changed from % to mod.

Also, a new web services library is in the works that will make it even easier to communicate with remote services required by your application.  As a result, the JSON and XML libraries are being pruned from the Technical Preview Release branch, but they are still available in the SVN repository if you need them.  You can read the current thinking about the web services library in this message on the dev@openjfx-compiler.dev.java.net mailing list.  As is typical with JavaFX libraries, the likely outcome will be a simplification of the design in that message.

Finally, I'd like to point out something that is very exciting to me -- the fact that JavaFX is migrating to a "node-centric" approach.  As you may know, underneath the covers of the JavaFX UI for the desktop are Java Swing (components) and Java2D classes (graphical nodes).  Eventually, most UI constructs in JavaFX will be graphical nodes, including the components (e.g. Button) and layout panels (e.g. BorderPanel).  This will eliminate the need for using "adapter" classes like Canvas (to place a node on a panel) and ComponentView (to place a component on a Canvas).  This will also make it easier to create UIs that have an "iPhone look and feel" that users will increasingly expect.  As you can see by the fact that Dialog, Frame and Window exist in two packages (javafx.application and javafx.ext.swing), this migration has already begun.  An examination of the JavaFX documentation for the Frame class in the javafx.application package, for example, will show you that the content attribute of its Window superclass contains a sequence of Node objects.  Compare this with the Frame class in the java.ext.swing package whose Window superclass has a content attribute that still contains a sequence of Component objects.  The latter, by the way, will be around at least until the migration to a node-centric UI is complete.

Have fun, and please post a comment if you have any questions!
Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications

Immediate eBook (PDF) download available at the book's Apress site

June 12, 2008

Check out the JavaFX Script Documentation

Note from Jim Weaver: Since this was written, an updated version of JavaFX has been released.  You can get the new version of JavaFX at at JavaFX.com.

In the Playing with the JavaFX SDK as it's Being Built post I showed you how to get started developing with what will become the JavaFX SDK Preview Release, due in July 2008.  Now I'd like to show you a couple of ways to access the JavaFX Script documentation as it's being developed, to help you write JavaFX programs:

  1. View the online JavaFX Script Documentation page for the latest build.
  2. Browse the documentation that is included with the download of the latest JavaFX compiler buildNote: At the time of this writing, there is a technology preview branch of the compiler build that may be downloaded here.  This branch is what will become the JavaFX SDK Preview Release.

As you can see in the screenshot below, this documentation includes the JavaFX API as well as the JavaFX language reference:

Jfx_docs_3

As you're looking at the API documentation, please keep in mind that the UI classes that will be in the JavaFX SDK are in the packages that begin with javafx.gui. The older, prototype UI classes (packages beginning with javafx.ui) will be going away soon.

JFX BootCamp in Oslo, Norway, on June 18-20, 2008

If you happen to be in the vicinity of Oslo, Norway later this month, please come to the free JavaFX Script seminar sponsored by Bouvet on June 18, 2008.  I'll be teaching the seminar, followed by a two day JavaFXpert BootCamp.  Contact Bouvet for information on registering for the BootCamp. 

Enjoy!
Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications
Immediate eBook (PDF) download available at the book's Apress site

June 09, 2008

Playing with the JavaFX SDK as it's Being Built

As I mentioned in the JFX and the Way Forward After JavaOne 2008 post, Sun announced at JavaOne that a preview release of the JavaFX SDK is scheduled to be available in July 2008.  As a pleasant surprise over Memorial Day weekend, Sun opened up the development of this preview release SDK.  This development activity is occurring as a part of the OpenJFX Compiler project, so follow the instructions that I gave you in the Obtaining the OpenJFX Script Compiler Just Got Easier post and join the fun!  You'll be playing with the JavaFX SDK as it is being built, so expect changes.  It would also be great if you'd provide input to the process, and help test the SDK as it's being developed.

Write Your First JavaFX Program that Uses the New Classes

The JavaFX code below uses the newer UI classes, and I'll show you how to compile and run this code in a bit.  When the application first starts up, an empty window appears with two buttons:

Blank

When you click the Hello button, the message "You say hello..." from the popular "Hello, Goodbye" Beatles song displays approximately in the center of the window:

Hello

When you click the Goodbye button, the message "and I say goodbye" appears in place of the former message:

Goodbye

Here's the JavaFX code that generated this user interface and functionality:

/*
* HelloGoodbye.fx -
* A "Hello World" style program that demonstrates
* declaratively expressing a user interface. 
*/
package beatles;
import javafx.ext.swing.BorderPanel;
import javafx.ext.swing.Button;
import javafx.ext.swing.Canvas;
import javafx.ext.swing.FlowPanel;
import javafx.ext.swing.Frame;
import javafx.scene.Font;
import javafx.scene.text.Text;

Frame {
  var phrase:String
  title: "Hello, Goodbye"
  height: 300
  width: 400
  visible: true
  content:
    BorderPanel {
      center:
        Canvas {
          content:
            Text {
              x: 50
              y: 125
              content: bind phrase
              font:
                Font {
                  size: 36
                }
            }
        }
      bottom:
        FlowPanel {
          content: [
            Button {
              text: "Hello"
              action:
                function():Void {
                  // The button was clicked
                  phrase = "You say hello...";
                }
            },
            Button {
              text: "Goodbye"
              action:
                function():Void {
                  phrase = "and I say goodbye";
                }
            }
          ]
        }       
    }
}

Compiling and Running the Program

To compile this program, enter the following into the command line:

javafxc -d . HelloGoodbye.fx

As in Java, the -d option causes the CLASS files to be put into a directory corresponding to the package statement subordinate to the specified directory.  To run the program, use the following command:

javafx beatles.HelloGoodbye

Now that you've got access to the JavaFX SDK as it's being built, get involved by writing JavaFX programs that exercise its functionality, and subscribe to one or more of the following mailing lists from this page.

users@openjfx-compiler.dev.java.net

gui@openjfx-compiler.dev.java.net

dev@openjfx-compiler.dev.java.net

Have fun, and please post a comment if you have any questions!
Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications

Immediate eBook (PDF) download available at the book's Apress site

My Photo

Upcoming Speaking Engagements:


  • Stephen Chin and Jim Weaver speaking about JavaFX Platform

  • Speaking on JavaFX and Java at Øredev in Malmö, Sweden on 2-6 November, 2009

Upcoming JavaFX Training:


  • Developing Secure, Rich Internet Applications Hosted on a Variety of Clients Using JavaFX Technology

Enter your email address:

Delivered by FeedBurner

Available now as early access eBook


  • Click book image above to obtain eBook

Twitter Updates

    follow me on Twitter

    Affiliations:

    DZone Links:


    July 2009

    Sun Mon Tue Wed Thu Fri Sat
          1 2 3 4
    5 6 7 8 9 10 11
    12 13 14 15 16 17 18
    19 20 21 22 23 24 25
    26 27 28 29 30 31  

    Disclaimer:

    • By reading this site, you are agreeing that under no circumstances will Veriana Networks, Inc. or its affiliates be responsible for (1) any information contained on or omitted from the site, (2) any person's reliance on any such information, whether or not the information is correct, current or complete, (3) the consequences of any action you or any other person takes or fails to take, whether or not based on information provided by or as a result of the use of the sites.