3. www.devoxx.com
Speaker’s qualifications
Core Engineers on JavaFX at Sun Microsystems
Jasper is the design wizard for FX and author of
the Charts API
Richard is API design lead for FX, UI Controls lead,
and key scenegraph developer
Both write lots of cool stuff
7. www.devoxx.com
Threading
All data access should occur on background thread
JavaFX Script is currently single threaded
Never create JavaFX objects on a background thread!
Use the Task API
Subclass from JavaTaskBase
13. www.devoxx.com
Writing a Custom Task
Step 1: Subclass from JavaTaskBase
Step 2: Create a Java implementation peer
Step 3: Callback from the peer to the task on
completion
Step 4: Create FX objects, do FX work on the FX
thread
14. Step 1: Subclass
public class LoginTask extends JavaTaskBase {
public-init var username:String;
public-init var password:String;
public-read var token:String;
}
18. Step 4: FX
public class LoginTask extends JavaTaskBase, FinishedHandler {
...
override public function backgroundWorkFinished():Void {
FX.deferAction(function():Void {
token = impl.token;
});
}
}
25. www.devoxx.com
Progress Indicator
Small circular progress indicator
Bind directly to task.percentDone
Example:
var task = CustomTask { ... }
ProgressIndicator { progress: bind task.percentDone }
26. www.devoxx.com
TextBox
Single or Multiline (single style) text input
Useful for building other controls
like a search box
Example:
var t:TextBox = TextBox {
promptText: “Search”
action: function() {
startSearch(t.text);
t.text = “”;
}
}
36. www.devoxx.com
CSS
CSS is our strategy for styling. If you use our UI
Controls, you use CSS.
Caspian is our default CSS stylesheet
CSS is fast, and works on mobile, desktop, and tv
Stick to the spirit of HTML CSS, but do not be
bound by it
37. www.devoxx.com
Regions
Break control skins in stylable parts
In some ways similar to HTML CSS’s Box but not
that same
Can be Rectangle with independently rounded
corners or any arbitrary path
Can have multiple background fills, background
images, border strokes and border images
46. www.devoxx.com
Summary
JavaFX is serious about the enterprise
it is what we do
Many additional controls coming in next release
Extensive support for styling controls