Book Example Updated for JavaFX Script SDK: HelloJFX
Join the DZone community and get the full member experience.Join For Free
in response to the the javafx sdk packages are taking shape post , a reader named john writes: "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?"
i responded in agreement, so the next several blog posts are going to contain the examples from my javafx script book, rewritten to work with the javafx sdk technology preview release. the first one is the hellojfx program, for which this is the ui:
by the way, the ebook version of the javafx script book is available for download from this apress site.
the updated code for hellojfx
here is the code, updated by a colleague and javafx developer named matt shirey:
* hellojfx.fx - a javafx script "hello world" style example
* developed 2007 by james l. weaver (jim.weaver at jmentor dot com)
* updated july 2008 by matt shirey (email@example.com) for javafx sdk technology preview 1
title: "hello world-style example for javafx script"
name: "sans serif"
content: "hello javafx script developer!"
// show the frame on the screen
running this example
the javafx sdk technology preview branch of the compiler build may be downloaded here . this branch is what will become the javafx sdk preview release. after adding the openjfx-compiler-tp1/dist/bin directory to your path environment variable, and verifying that you have the java runtime environment (jre) 6 installed, use the following command at your operating system prompt to compile the program:
javafxc -d . hellojfx.fx
to run the program, use the following command:
have fun, and please post a comment if you have any questions!
javafx script: dynamic java scripting for rich internet/client-side applications
immediate ebook (pdf) download available at the book's apress site
Opinions expressed by DZone contributors are their own.