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






"Looks like I'll spend my entire long weekend trying to figure out how to make a simple 3x3 array of rectangles since GridPanel is gone huh?"
Bill,
There are a couple of options available now to create a grid of nodes
1) Use HBox and VBox, as shown in the following Create a Simple Calculator series:
http://javafxpert.com/weblog/simple-calculator-app/
2) Use the new Grid class in the JFXtras project. See the following post:
http://javafxpert.com/weblog/2008/12/jfxtras-01-release-utilities-and-addons-for-the-javafx-language.html
Regards,
Jim Weaver
Posted by: Jim Weaver | January 01, 2009 at 01:16 PM
Looks like I'll spend my entire long weekend trying to figure out how to make a simple 3x3 array of rectangles since GridPanel is gone huh?
Posted by: Bill Thayer | January 01, 2009 at 12:59 PM
Hi James !!
It's nice to see your blog and thanks a lot for your javafx script book. It helped me a lot in uderstanding the structure for writing my basic script. I wanted to know that If I have to make a big appliaction and required handling database,logging,network,internationlization etc, then will it be suitable to use JavaFx. Can we use any existing framework like Swing application framework to support life cycle. Please help
Thanks
Shahid
Posted by: Shahid | September 18, 2008 at 04:06 AM
I miss the TextArea component and a multi line label.
Posted by: Silveira Neto | July 23, 2008 at 07:47 PM
The demos won't compile outside netbeans!
First:
-do-compile:
[javac] Compiling 2 source files to /Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/Assortis/build/classes
[javac] /Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/Assortis/src/assortis/core/ProjectManager.java:136: package org.jvnet.substance.fonts does not exist
[javac] org.jvnet.substance.SubstanceLookAndFeel.setFontPolicy(org.jvnet.substance.fonts.SubstanceFontUtilities.getScaledFontPolicy(1.25f));
[javac] ^
[javac] /Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/Assortis/src/assortis/core/ProjectManager.java:136: package org.jvnet.substance does not exist
[javac] org.jvnet.substance.SubstanceLookAndFeel.setFontPolicy(org.jvnet.substance.fonts.SubstanceFontUtilities.getScaledFontPolicy(1.25f));
[javac] ^
[javac] Note: /Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/Assortis/src/assortis/core/ProjectManager.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
BUILD FAILED
/Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/build.xml:9: The following error occurred while executing this line:
/Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/Assortis/nbproject/build-impl.xml:375: The following error occurred while executing this line:
/Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/Assortis/nbproject/build-impl.xml:172: Compile failed; see the compiler error output for details.
After commenting out the troublesome code, one gets dependencies from netbeans:
/Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/build.xml:9: The following error occurred while executing this line:
/Users/hansi/Downloads/archive/openjfx-compiler-tp1/dist/demos/BasicDND/nbproject/build-impl.xml:428: taskdef class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs cannot be found
Posted by: hansi | July 02, 2008 at 12:23 PM
Coffeejolts wrote: Jim, Will the jmc.dll be included with the SDK Preview? I am dying to try it out in an app that I'm working on.
Yes, I believe that the plan is to provide the jmc.dll with the Technology Preview Release.
Posted by: Jim Weaver | July 02, 2008 at 11:41 AM
Jim, Will the jmc.dll be included with the SDK Preview? I am dying to try it out in an app that I'm working on.
Posted by: coffeejolts | July 02, 2008 at 11:35 AM
Coffeejolts wrote: "Well, I figured out part of the problem: my URI was malformed. Now, I am getting com.sun.media.jmc.MediaUnsupportedException: Unsupported media: file:/C:/test1.mp3"
Currently the supported media types for Windows are ones that will run in MediaPlayer, and the supported media types for Mac are ones that will run in QuickTime. Two common media types between Windos and Mac are MPEG and MP2. Also, you may be aware that at JavaOne support for the ON2 media type was announced, which will be more universal. At the present moment, video and audio works on Windows, and audio works on Mac, with video hopefully close on its heels.
-Jim Weaver
Posted by: Jim Weaver | July 02, 2008 at 08:26 AM
John wrote: "Will you create an updated source of the examples of the book that run with the latest JFX update?"
That's a great idea, John. The JavaFX SDK Technology Preview seems to be settling down enough to make this worth the effort, so please watch this blog for a posts entitled "Updated JavaFX Script Book Example: [Example Name]"
Posted by: Jim Weaver | July 02, 2008 at 08:16 AM
Geekycoder wrote: "The modulus (remainder) has been changed from % to mod. I wonder why they change it to mod when % is currently in use."
I think that the rationale was to follow the pattern that was set with "not", "and", && "or" (rather than "!", "&&", "||". The target audience for JavaFX is designers && developers, so the thinking is that mod is easier to remember than %. || I could be wrong about this, ! that I haven't been wrong before.
- Jim Weaver
Posted by: Jim Weaver | July 02, 2008 at 08:09 AM
Hi James,
I started with the examples in your nice book. However, I see that many things have changed in JFX since then. E.g. javafx.ui.* classes have been replaced by javafx.ext.swing.* classes? And of course many examples do not run. Will you create an updated source of the examples of the book that run with the latest JFX update?
Thanks
John.
Posted by: John | July 02, 2008 at 06:59 AM
Wow, thank for the information.
"The modulus (remainder) has been changed from % to mod."
I wonder why they change it to mod when % is currently in use.
Posted by: geekycoder | July 01, 2008 at 06:52 AM
Well, I figured out part of the problem: my URI was malformed. Now, I am getting
com.sun.media.jmc.MediaUnsupportedException: Unsupported media: file:/C:/test1.mp3
Posted by: Coffeejolts | June 30, 2008 at 10:39 AM
James,
I am still having trouble getting the media support to work. Using the pasted code and the tp1 sdk, I get the following exception.
FX Media Object caught Exception com.sun.media.jmc.MediaUnavailableException: Media unavailable: C:/test1.mp3
The file is there and should be playable. I am no longer getting the unable to load jmc library exception, though, which is an improvement.
Frame{
width: 200
height: 200
content:[
MediaView{
mediaPlayer: MediaPlayer{
media: Media{
source: "C:/test1.mp3"
}
autoPlay: true
}
}
]
visible: true
}
Posted by: Coffeejolts | June 30, 2008 at 10:22 AM
now, If only I could find a supported media type for a MediaPlayer demo on my Mac I would be happy!
Posted by: magomarcelo | June 30, 2008 at 07:13 AM
The Technology Preview has the Frame, Dialog and Window classes in both packages. You can download the Technology Preview at the following URL:
http://openjfx.java.sun.com/hudson/job/openjfx-compiler-technology-preview/lastSuccessfulBuild/artifact//*zip*/archive.zip
Posted by: Jim Weaver | June 27, 2008 at 09:50 PM
Thanks for posting this but according to the API, Frame Window and Dialog are now in javafx.ext.swing not javafx.application.
Posted by: Scott Hommel | June 27, 2008 at 07:37 PM