SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Downloaden Sie, um offline zu lesen
Scratching the Surface
with JavaFX
Jim Weaver
Java Technology Ambassador
Oracle Corporation
@JavaFXpert
james.weaver@oracle.com
Multi-touch
considerations
for JavaFX
 Touch Gestures
– Swipe, Scroll, Rotate, Zoom
 Touch Event and Touch Points
 The Pagination Control
 Accommodating Fingers
 Introduction to JavaFX 3D
 Example app: ZenGuitar3D
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.
Touch Gestures
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
Handling the Swipe Gesture (SwipeEvent)
Note: Lambda expressions
from JDK 8 are used here to
simplify event handling
Handling the Swipe Gesture (SwipeEvent)
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
Handling the Scroll Gesture (ScrollEvent)
The Rotate Gesture
 User typically drags two fingers around
each other
 Rotate events are continuously generated,
containing angle-related info
Handling the Rotate Gesture (RotateEvent)
The Zoom Gesture
 User typically drags two fingers apart or
closer together
 Zoom events are continuously generated,
containing zoom factor-related info
Handling the Zoom Gesture (ZoomEvent)
Touch Event and Touch Points
Thomas Laenner - http://thomas.laenner.dk/
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
Responding to Touch Events
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
The Pagination Control
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
Using the Pagination Control
Accommodating Fingers
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
Making UI Controls Larger for Touching
Specify an -fx-font-size
property in the #root selector
Introduction to JavaFX 3D
“JavaFX 3D gives you the ability to use 3D geometry,
cameras, and lights in JavaFX.”
Mesh Geometry (3D Shapes)
■ Predefined shapes
■ Box
■ Cylinder
■ Sphere
■ User-defined shapes
■ Using TriangleMesh / MeshView
26
27
Creating Primitive Shapes and Materials
3D Materials and Textures
■ PhongMaterial has these properties
■ Ambient color
■ Diffuse color, diffuse map
■ Specular color, specular map
■ Specular power
■ Bump map
■ Self-illumination map
28
https://wikis.oracle.com/display/OpenJDK/3D+Features
Duke’s nose has a Diffuse Map texture
29
This planet has a Bump Map texture
30
UV Mapping Textures to Shapes
31
Tip: A texture is a 2D image to
be mapped on a 3D surface
Source: http://en.wikipedia.org/wiki/File:UVMapping.png
Placing a Texture on a Sphere
32
Placing a Texture on a Sphere
33
3D Lights
■ Lights are nodes in the scene graph
■ PointLight
■ AmbientLight
■ Default light provided if no active lights
34
35
Lights, Camera, Action!
Example multi-touch app:
ZenGuitar3D
37
Showing the Picker (TouchEvent)
38
Rotating Instrument Picker with Scroll Gesture
39
Playing Strings (TouchEvent / TouchPoint)
40
Switching Modes (TouchPoint#belongsTo)
41
Setting up to Rotate on Three Axes
42
Using Scroll Gesture for X/Y Rotate
43
Using Rotate Gesture for Z Rotate
44
Using Zoom Gesture for Scaling
45
Using Timeline to Transform to Home Position
46
ZenGuitar3D Uses the JFugue5 Library
■ An open-source Java API for
programming music without the
complexities of MIDI
■ Developed by David Koelle
■ Available at http://JFugue.org
47
Start Here: http://javafxcommunity.com
48
Download JDK 8 Early Access Release
49
Visit Here: http://fxexperience.com
Tip: This site is
authored by
Oracle JavaFX
Engineers
Questions?
Scratching the Surface
with JavaFX
Jim Weaver
Java Technology Ambassador
Oracle Corporation
@JavaFXpert
james.weaver@oracle.com
Scratching the Surface with JavaFX

Weitere ähnliche Inhalte

Ähnlich wie Scratching the Surface with JavaFX

Flash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic listFlash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic list
Small Screen Design
 
Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures
Vu Tran Lam
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
senthil0809
 

Ähnlich wie Scratching the Surface with JavaFX (20)

Mobile Application Development class 005
Mobile Application Development class 005Mobile Application Development class 005
Mobile Application Development class 005
 
Advance ui development and design
Advance ui  development and design Advance ui  development and design
Advance ui development and design
 
Flash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic listFlash Lite & Touch: build an iPhone-like dynamic list
Flash Lite & Touch: build an iPhone-like dynamic list
 
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing ButtonsJAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
 
Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures
 
Windows Store apps - Lessons Learned
Windows Store apps - Lessons LearnedWindows Store apps - Lessons Learned
Windows Store apps - Lessons Learned
 
Android Training - Pull to Refresh
Android Training - Pull to RefreshAndroid Training - Pull to Refresh
Android Training - Pull to Refresh
 
Virtual Reality(full)
Virtual Reality(full)Virtual Reality(full)
Virtual Reality(full)
 
What is Event
What is EventWhat is Event
What is Event
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Event handling in Java(part 1)
Event handling in Java(part 1)Event handling in Java(part 1)
Event handling in Java(part 1)
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 
Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 
Introduction to development
Introduction to developmentIntroduction to development
Introduction to development
 
PROGRAMMING IN JAVA- unit 4-part II
PROGRAMMING IN JAVA- unit 4-part IIPROGRAMMING IN JAVA- unit 4-part II
PROGRAMMING IN JAVA- unit 4-part II
 
Mixed Reality from demo to product
Mixed Reality from demo to productMixed Reality from demo to product
Mixed Reality from demo to product
 
Advance java for bscit
Advance java for bscitAdvance java for bscit
Advance java for bscit
 
Human Interaction Library
Human Interaction LibraryHuman Interaction Library
Human Interaction Library
 

Mehr von javafxpert

Mehr von javafxpert (7)

Machine Learning Exposed!
Machine Learning Exposed!Machine Learning Exposed!
Machine Learning Exposed!
 
Java 101
Java 101Java 101
Java 101
 
Raspberry Pi with Java 8
Raspberry Pi with Java 8Raspberry Pi with Java 8
Raspberry Pi with Java 8
 
Autonomous Drone Development with Java and IoT
Autonomous Drone Development with Java and IoTAutonomous Drone Development with Java and IoT
Autonomous Drone Development with Java and IoT
 
J-Fall 2014 Community Keynote by Oracle
J-Fall 2014 Community Keynote by OracleJ-Fall 2014 Community Keynote by Oracle
J-Fall 2014 Community Keynote by Oracle
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
 
Asean dev-days-slides
Asean dev-days-slidesAsean dev-days-slides
Asean dev-days-slides
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Scratching the Surface with JavaFX