SlideShare a Scribd company logo
Using multi-touch and sensors
in Java

Felipe Pedroso
Agenda

• The future of PCs
• JavaFX and Touch Support
• Using JNI to work with sensors

2
Mobile Computing Lines are Blurring
Smartphone

Consumption Usages

Tablet

Ultrabook™
Convertible & Detachable

Ultrabook™

Creation/Productivity

Notebook
Reshaping the PC Experience
Multi-Touch
Accelerometer

Ambient
Light Sensor

Ultrabook™

Compass

GPS

Gyroscope

Near Field
Communication

Context Aware
Sensors
4
OK, they have all those
features…
… but how can we implement them using Java?
To allow users to TOUCH my Java App...
• Should I use...
• AWT?
• Swing?
• SWT?

• Actually, you can use them but...
• They aren’t made for multi-touch (OK, there’s a way to do it)
• You must optimize your UI controls to be more ‘touch friendly’

• So, how to do it in a simple and easy way?

6
7
Actions supported
• Touch events: Down, Move and Up
• Tap (Down and Up) / Double tap
• Drag and Drop (Down, Move and Up)
• Hold

• Gestures
• Swipe: Up, Down, Left and Right
• Zoom: Pinch / Spread
• Rotate

8
What I need to do to manipulate components?
• Your components must extend the Node class or any of its
subclasses (StackPane, ImageView, etc)
• Set the proper EventHandler to handle the action.

9
What I need to do to manipulate components?
• Apply a transform to the component (Translation, Rotation and
Scale):

• Let’s dive into some code!

10
What about the sensors?

JNI, I choose you!
Available sensors on Ultrabooks
• Accelerometer
• Proper acceleration in three axis (x, y, z)

• Gyrometer
• Device orientation

• Magnetometer
• Strenght and direction of magnetic fields

• GPS (Global Positioning System)
• Location and Time information

• NFC
• Near Field Communication

• Ambient Light Sensor
• Ambient Light Level

12
API Windows – Sensor Fusion

13
API Windows – Namespaces
• Windows.Sensors.*  Common sensors
•
•
•
•
•
•
•

Accelerometer
Gyrometer
Inclinometer
OrientationSensor
SimpleOrientationSensor
Compass
LightSensor

• Windows.Devices.Geolocation

 GPS

• Geolocator

• Windows.Networking.Proximity  NFC
• ProximityDevice

14
Windows API – How to
• Get the default object of your sensor using the GetDefault method
• You can call the GetCurrentReading() to get the current value of the
sensors or...
• ... work with the ReadingChanged event
• Set the attribute ReportInterval (please, respect the MinimumReportInterval to avoid problems)
• Delegate a method to handle the event (something like setting a method as a listener)
• Handle the event!

• This procedure is valid only for sensors from Windows.Sensors
namespace

15
How can I access that?

16
Using JNI to access the sensors from
Windows.Sensors
1. [Java] Create a native method to register the object that will
handle the events that come from the sensor
2. Generate the header file using javah

3. [C++] Create a DLL Project in Visual Studio with the DLLs
and namespaces of the Windows 8 APIS
4. [C++] Use a variable to keep a reference to the object and
the ID (GetMethodID) of the method that will handle the
event
17
Using JNI to access the sensors from
Windows.Sensors
5. [C++] Initialize the sensor and delegate a C++ method to
handle the event
6. [C++] Redirect the delegate method call to the Java method
using the function CallVoidMethod with the following
parameters: the Java Object, the method ID and it’s
parameters
7. [Java] Handle the event! 
A lot of text? Please, show me the code!
18
What about Linux?
• Touch works fine, but there aren’t clear APIs to read
sensors. If you know how to do it, let’s work together!

19
Wants to know more about Intel Software?
http://software.intel.com/pt-br/

20
Windows Community
http://software.intel.com/en-us/windows

21
www.javafxcommunity.com

22
JFXtras.org

23
Take aways
• The PC experience is being reshaped
• JavaFX + Touch = AWESOME

• Using JNI to access the sensors can be LEGENDARY!
Any doubts?
(if yes, the answer is 42)
Thanks a lot!
Felipe Pedroso
facebook.com/felipe.a.pedroso
@felipeapedroso

More Related Content

PPTX
Finger gesture controlled LCD display using IR sensors
PPT
Light pen
ODP
Project
PDF
Metaverse1 Use case 2 assisted ambient living for the elderly
PPTX
Sixth sense technology
PPTX
Sixth Sense Technology
PPTX
Mouse simulation using coloured tape
PPTX
SIT - Microsoft Kinect
Finger gesture controlled LCD display using IR sensors
Light pen
Project
Metaverse1 Use case 2 assisted ambient living for the elderly
Sixth sense technology
Sixth Sense Technology
Mouse simulation using coloured tape
SIT - Microsoft Kinect

What's hot (13)

PPTX
Sit microsoft kinect
PDF
Event Touch / Gestures
PPTX
Virtual Keyboard
PPTX
Pradeep6th sence
PPSX
Virtual Keyboard
PDF
Intel real sense handson
PPTX
Final
PPTX
Virtual keyboard
PPTX
Scanning text and images using scanner
PPTX
Virtual keyboard
PPTX
Sixth sense technology
PPTX
Virtual keyboard
PDF
Augmented Reality with the Intel® RealSense™ SDK and R200 Camera
Sit microsoft kinect
Event Touch / Gestures
Virtual Keyboard
Pradeep6th sence
Virtual Keyboard
Intel real sense handson
Final
Virtual keyboard
Scanning text and images using scanner
Virtual keyboard
Sixth sense technology
Virtual keyboard
Augmented Reality with the Intel® RealSense™ SDK and R200 Camera
Ad

Similar to Using multitouch and sensors in Java (20)

PPTX
Developing Rich Interfaces in JavaFX for Ultrabooks
PPT
Virtual Mouse
PDF
Developing Rich Interfaces in JavaFX for Ultrabooks
PDF
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
PPTX
Virtual Reality
PDF
virtual reality Information-160422181930.pdf
PPTX
A computer vision based virtual mouse
PPTX
OBJECT DETECTION FOR VISUALLY IMPAIRED USING TENSORFLOW LITE.pptx
PPTX
Sixth sense technology ppt
PPT
Sixth sense techno_ppt
PPTX
Postmortem of a uwp xaml application development
PPTX
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
PPTX
Touchless Touchscreen presentation .pptx
PPTX
Touchless Touchscreen
PPTX
Sixth sense technology ppt
PPTX
Touchless touchscreen technology
PPTX
Touchless touchscreen technology
PDF
Mobile AR Lecture 10 - Research Directions
PPTX
Touchless Touchscreen Technology
PPTX
realtimeobject (2).pptx
Developing Rich Interfaces in JavaFX for Ultrabooks
Virtual Mouse
Developing Rich Interfaces in JavaFX for Ultrabooks
JAVA PROGRAMMING- GUI Programming with Swing - The Swing Buttons
Virtual Reality
virtual reality Information-160422181930.pdf
A computer vision based virtual mouse
OBJECT DETECTION FOR VISUALLY IMPAIRED USING TENSORFLOW LITE.pptx
Sixth sense technology ppt
Sixth sense techno_ppt
Postmortem of a uwp xaml application development
Everything About Android - Itvedant, Thane | Mumbai | Navi Mumbai
Touchless Touchscreen presentation .pptx
Touchless Touchscreen
Sixth sense technology ppt
Touchless touchscreen technology
Touchless touchscreen technology
Mobile AR Lecture 10 - Research Directions
Touchless Touchscreen Technology
realtimeobject (2).pptx
Ad

More from Intel Software Brasil (20)

PPTX
Modernização de código em Xeon® e Xeon Phi™
PDF
Escreva sua App sem gastar energia, agora no KitKat
PDF
Desafios do Desenvolvimento Multiplataforma
PDF
Desafios do Desenvolvimento Multi-plataforma
PDF
Yocto - 7 masters
PDF
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
PDF
Intel tools to optimize HPC systems
PDF
Methods and practices to analyze the performance of your application with Int...
PDF
Principais conceitos técnicas e modelos de programação paralela
PDF
Principais conceitos e técnicas em vetorização
PDF
Notes on NUMA architecture
PDF
Intel Technologies for High Performance Computing
PDF
Benchmarking para sistemas de alto desempenho
PDF
Yocto no 1 IoT Day da Telefonica/Vivo
PDF
Html5 fisl15
PDF
PDF
IoT TDC Floripa 2014
PDF
Otávio Salvador - Yocto project reduzindo -time to market- do seu próximo pr...
PDF
Html5 tdc floripa_2014
PDF
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5
Modernização de código em Xeon® e Xeon Phi™
Escreva sua App sem gastar energia, agora no KitKat
Desafios do Desenvolvimento Multiplataforma
Desafios do Desenvolvimento Multi-plataforma
Yocto - 7 masters
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Intel tools to optimize HPC systems
Methods and practices to analyze the performance of your application with Int...
Principais conceitos técnicas e modelos de programação paralela
Principais conceitos e técnicas em vetorização
Notes on NUMA architecture
Intel Technologies for High Performance Computing
Benchmarking para sistemas de alto desempenho
Yocto no 1 IoT Day da Telefonica/Vivo
Html5 fisl15
IoT TDC Floripa 2014
Otávio Salvador - Yocto project reduzindo -time to market- do seu próximo pr...
Html5 tdc floripa_2014
Desenvolvimento e análise de performance de jogos Android com Coco2d-HTML5

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
Teaching material agriculture food technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Empathic Computing: Creating Shared Understanding
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Digital-Transformation-Roadmap-for-Companies.pptx
Machine learning based COVID-19 study performance prediction
Encapsulation_ Review paper, used for researhc scholars
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Teaching material agriculture food technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
Empathic Computing: Creating Shared Understanding

Using multitouch and sensors in Java

  • 1. Using multi-touch and sensors in Java Felipe Pedroso
  • 2. Agenda • The future of PCs • JavaFX and Touch Support • Using JNI to work with sensors 2
  • 3. Mobile Computing Lines are Blurring Smartphone Consumption Usages Tablet Ultrabook™ Convertible & Detachable Ultrabook™ Creation/Productivity Notebook
  • 4. Reshaping the PC Experience Multi-Touch Accelerometer Ambient Light Sensor Ultrabook™ Compass GPS Gyroscope Near Field Communication Context Aware Sensors 4
  • 5. OK, they have all those features… … but how can we implement them using Java?
  • 6. To allow users to TOUCH my Java App... • Should I use... • AWT? • Swing? • SWT? • Actually, you can use them but... • They aren’t made for multi-touch (OK, there’s a way to do it) • You must optimize your UI controls to be more ‘touch friendly’ • So, how to do it in a simple and easy way? 6
  • 7. 7
  • 8. Actions supported • Touch events: Down, Move and Up • Tap (Down and Up) / Double tap • Drag and Drop (Down, Move and Up) • Hold • Gestures • Swipe: Up, Down, Left and Right • Zoom: Pinch / Spread • Rotate 8
  • 9. What I need to do to manipulate components? • Your components must extend the Node class or any of its subclasses (StackPane, ImageView, etc) • Set the proper EventHandler to handle the action. 9
  • 10. What I need to do to manipulate components? • Apply a transform to the component (Translation, Rotation and Scale): • Let’s dive into some code! 10
  • 11. What about the sensors? JNI, I choose you!
  • 12. Available sensors on Ultrabooks • Accelerometer • Proper acceleration in three axis (x, y, z) • Gyrometer • Device orientation • Magnetometer • Strenght and direction of magnetic fields • GPS (Global Positioning System) • Location and Time information • NFC • Near Field Communication • Ambient Light Sensor • Ambient Light Level 12
  • 13. API Windows – Sensor Fusion 13
  • 14. API Windows – Namespaces • Windows.Sensors.*  Common sensors • • • • • • • Accelerometer Gyrometer Inclinometer OrientationSensor SimpleOrientationSensor Compass LightSensor • Windows.Devices.Geolocation  GPS • Geolocator • Windows.Networking.Proximity  NFC • ProximityDevice 14
  • 15. Windows API – How to • Get the default object of your sensor using the GetDefault method • You can call the GetCurrentReading() to get the current value of the sensors or... • ... work with the ReadingChanged event • Set the attribute ReportInterval (please, respect the MinimumReportInterval to avoid problems) • Delegate a method to handle the event (something like setting a method as a listener) • Handle the event! • This procedure is valid only for sensors from Windows.Sensors namespace 15
  • 16. How can I access that? 16
  • 17. Using JNI to access the sensors from Windows.Sensors 1. [Java] Create a native method to register the object that will handle the events that come from the sensor 2. Generate the header file using javah 3. [C++] Create a DLL Project in Visual Studio with the DLLs and namespaces of the Windows 8 APIS 4. [C++] Use a variable to keep a reference to the object and the ID (GetMethodID) of the method that will handle the event 17
  • 18. Using JNI to access the sensors from Windows.Sensors 5. [C++] Initialize the sensor and delegate a C++ method to handle the event 6. [C++] Redirect the delegate method call to the Java method using the function CallVoidMethod with the following parameters: the Java Object, the method ID and it’s parameters 7. [Java] Handle the event!  A lot of text? Please, show me the code! 18
  • 19. What about Linux? • Touch works fine, but there aren’t clear APIs to read sensors. If you know how to do it, let’s work together! 19
  • 20. Wants to know more about Intel Software? http://software.intel.com/pt-br/ 20
  • 24. Take aways • The PC experience is being reshaped • JavaFX + Touch = AWESOME • Using JNI to access the sensors can be LEGENDARY!
  • 25. Any doubts? (if yes, the answer is 42)
  • 26. Thanks a lot! Felipe Pedroso facebook.com/felipe.a.pedroso @felipeapedroso