developing javafx apps for tablets
TRANSCRIPT
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 131
Developing JavaFX Apps for Tablets(JavaFX Multi-touch Features)
Jim Weaver
Java Technology Ambassador
Oracle Corporation
@JavaFXpert
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 132 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16
JavaFXMulti-touch Features
Touch Gestures
– Swipe, Scroll, Rotate, Zoom
Touch Event and Touch Points
The Pagination Control
Accommodating Fingers
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 133 3
Please note
The following is intended to outline our general product
direction. It is intended for information purposes only, and
may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing
decisions. The development, release, and timing of any
features or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 134
Touch Gestures
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 135
The Swipe Gesture
Commonly a finger drag in one direction
A single event is produced for the gesture
May be left, right, up, or down
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 136
Handling the Swipe Gesture (SwipeEvent)
Note: Lambda expressions from JDK 8 are used here to simplify event handling
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 137
Handling the Swipe Gesture (SwipeEvent)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 138
The Scroll Gesture
User turns mouse wheel, drags finger on
touch screen, etc.
Scroll events are continuously generated,
containing x/y position-related info
Events are pixel-based or character/line-
based
If inertia is supported, scroll events may
be generated after user quits scrolling
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 139
Handling the Scroll Gesture (ScrollEvent)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1310
The Rotate Gesture
User typically drags two fingers around
each other
Rotate events are continuously generated,
containing angle-related info
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1311
Handling the Rotate Gesture (RotateEvent)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1312
The Zoom Gesture
User typically drags two fingers apart or
closer together
Zoom events are continuously generated,
containing zoom factor-related info
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1313
Handling the Zoom Gesture (ZoomEvent)
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1314
Touch Event and Touch Points
Thomas Laenner - http://thomas.laenner.dk/
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1315
Handling Touch (TouchEvent/TouchPoint)
A TouchEvent contains information about
a touch, including:
– Event type: Pressed, released, moved, or
stationary
– Touch points: The TouchPoint instances
that represent each of the points that were
touched
Each TouchEvent has a unique ID to identify the
events and touch points in a multi-touch action
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1316
Responding to Touch Events
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1317
A Touch Demo from the JavaFX Community
Touchyfxy app by Danno Ferrin http://speling.shemnon.com/
Touchfxy is an open source JavaFX
application developed by Danno Ferrin to
demonstrate gestures and touch events
To obtain Touchfxy, see Danno’s blog at
http://speling.shenmon.com
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1318
The Pagination Control
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1319
Using the Pagination Control
The Pagination control is used for
navigation between pages
Each page is a Node subclass
Numeric page indicators, or bullet-style
indicators, may be set with the style class STYLE_CLASS_BULLET
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1320
Using the Pagination Control
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1321
Accommodating Fingers
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1322
Making UI Controls Larger for Touching
The default sizes for
JavaFX UI controls are
conducive to using a
mouse as a pointing device
An easy way to modify the
default sizes is to use CSS
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1323
Making UI Controls Larger for Touching
Specify an -fx-font-size
property in the #root selector
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1324 24
Start Here: http://javafxcommunity.com
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1325 25
Download JDK 8 Early Access Release
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1326 26
Visit Here: http://fxexperience.com
Tip: This site is authored by Oracle JavaFXEngineers
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1327
Questions?
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1328
Developing JavaFX Apps for Tablets(JavaFX Multi-touch Features)
Jim Weaver
Java Technology Ambassador
Oracle Corporation
@JavaFXpert
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 1329