Vous êtes sur la page 1sur 36

Pro JavaFX Platform

RIA Enterprise Application Development


with JavaFX Technology
Stephen Chin
Inovis, Inc.
Jim Weaver
Veriana Networks, Inc.
RIA Enterprise Application Development with JavaFX Technology
2
Pro JavaFX Platform
Meet the Presenters
Jim
Steve
3
Motorcyclist
Family Man
Family Man
Inhabitant of 100 Acre Woods
4
I am, therefore I blog ;-)
steveonjava.com
Tweet: steveonjava
JavaFXpert.com
Tweet: JavaFXpert
And a Book
> Available as an eBook
today
> Print version ships in
June
> Includes JavaFX 1.2
> Chapters on:
! Mobile Development
! Advanced Layouts
! Back-end Integration
! WidgetFX/JFXtras
JavaFX Crash Course
7
JavaFX Tools and Resources
8
Start Here: JavaFX.com
9
JavaFX API Docs
10
Expressing the UI Scenegraph
11
Hello Earthrise
12
Hello Earthrise
JavaFX Mobile Development
JavaFX Mobile Advantages
> Write Once, Run Anywhere
! Desktop, Mobile, Set-top Boxes (future)
> Large Embedded Base
! Built on top of Java ME platform
> Wide Range of Devices
! Runs on Feature Phones, Smart Phones
JavaFX Mobile Constraints
> Screen Size
! Your application has to be capable of running within
a resolution of 320 by 240 or possibly even smaller.
> Common Profile
! Mobile applications are limited to the JavaFX APIs
that are part of the Common Profile, which is a
subset of the Desktop Profile.
> Performance
! Mobile applications run on much less powerful
devices, so they have less CPU and memory
resources available to work with.
Developing for the Common Profile
Package Class(es) Affected Variables and Methods
javafx.ext.swing All All
javafx.reflect All All
javafx.scene Node effect, style
javafx.scene Scene Stylesheets
javafx.scene.effect All All
javafx.scene.effect.light All All
javafx.scene.shape ShapeIntersect All
javafx.scene.shape ShapeSubstract All
javafx.scene.text Font
autoKern, embolden, letterSpacing, ligatures,
oblique, position
javafx.stage AppletStageExtension All
javafx.util FXEvaluator All
javafx.util StringLocalizer All
Mobile Demos
Hello Earthrise, Mobile DrawJFX
18
Controls/Binding/Triggers/Sequences
19
More Cowbell!
20
Transforms/Transitions/Timelines
21
Timeline Animation
Who is My Representative?
22
Web Service Integration
Calling a REST Service
> REST URL:
http://whoismyrepresentative.com/getall_mems.php?
zip=90210&output=json
> Output:
{ "results": [
{ "type": "rep", "name": "Henry A. Waxman",
"party": "D", "state": "CA", "district": "30", "phone":
"(202) 225-3976", "office": "2204 Rayburn", "link":
"http://www.henrywaxman.house.gov/" }
]}
23
Making an HttpRequest
req = HttpRequest {
method: HttpRequest.GET
location: url
onInput: parseResponse
onDone: function() {
if (req.responseCode != 200) {
message = req.responseMessage;
} else if (sizeof senators == 0 and sizeof representatives == 0) {
message = "No members found for {zipcode}";
}
}
onException: function(ex: java.lang.Exception) {
println("Exception: {ex.getClass()} {ex.getMessage()}");
}
}
req.start();
24
Was req.enque() in JavaFX 1.1
Using the Pull Parser
while (parser.event.type != PullParser.END_DOCUMENT) {
parser.seek( "type" );
if (parser.event.type == PullParser.START_VALUE) {
parser.forward();
if (parser.event.text == "rep") {
var rep = Representative{}
parseMemberOfCongress( rep, parser );
insert rep into representatives;
} else if (parser.event.text == "sen" ) {
var sen = Senator{}
parseMemberOfCongress( sen, parser );
insert sen into senators;
} } }
25
The JavaFX Desktop Widget Platform
WidgetFX
27
Why another desktop widget framework?
> Open-Source
! But widgets can be licensed commercially
> Cross-Platform Support
! Windows XP/Vista, Linux, and Mac OS X.
> One-Click Installation
! Plus automatic updates of the dock and widgets.
> Robust Security
! Secure sandbox + signed widgets
The Pac-Man Challenge!
> I Wish... Henry Zhang would make a
WidgetFX widget from his JavaFX
Pac-Man game
-- Jim Weaver
28
javafxpert.com
The Pac-Man Challenge!
> With about one week to go, I think it is
interesting and fun to give it a try.

After adjusting the width and height, it
was just simply working! (see the
image on the [right])
-- Henry Zhang
29
javafxgame.com
Learn how at the Friday WidgetFX session!
Movie Widget Tutorial
TS-3789: Getting Started with WidgetFX
10:50AM this Friday
JavaFX Puzzlers
FX
1.2
Puzzler 1
> What will this program display?:
Text {
textOrigin: TextOrigin.TOP
font: Font.font(null, 36)
content: the news
paper in the hand
bag was bent
}
" Output:
Puzzler 2
> What does this print out?
var cars = [
["z3", "m3", "x5"],
["a4", "r8", "tt"]
];
println("bmw: {cars[0]}");
println("audi: {cars[1]}");
bmw: z3
audi: m3
" Answer:
Puzzler 3
> What does this print out?
var value = [
10, 9, 8,
for (x in reverse [0..7]) {x}
-1
];
println(value);
[ 10, 9, 8, 6, 5, 4, 3, 2, 1, 0, -1 ]
" Answer:
There is no 7!
35
36
Stephen Chin
Jim Weaver
http://projavafx.com/
Book Plate Signing at 5:30
In front of the bookstore

Vous aimerez peut-être aussi