Upload
javadayua
View
852
Download
6
Embed Size (px)
Citation preview
JAVAFX 8MOHAMAD TAMANEnterprise Architect & Software Development ManagerEfinance, Cairo, Egypt.
Write once, run everywhere
ABOUT ME
JCP, Java Champions, Was JCP EC, won the 2014 Duke’s choice and 11th annual JCP adopt 2013 awards, Hacker, Speaks Java,
Architect, international speaker, IoT Geek, Author.
@_tamanm
about.me/mohamedtaman
ANNOUNCEMENTGet it from : https://www.packtpub.com/web-development/javafx-essentials
Or
http://www.amazon.com/JavaFX-Essentials-Mohamed-Taman/dp/1784398020
WHAT IS THE PROBLEM?
WE NEEDA next-generation Graphical User Interface (GUI) toolkit. As a platform that makes it easy to rapidly build high-performance Java client-side applications.
WE NEEDA GUI toolkit with underlying engines take advantage of modern GPUs through hardware accelerated graphics, while providing well-designed programming interfaces, thus enabling developers to combine graphics, animation, and UI controls.
INTRODUCTION
JAVA FX?JAVA + FLASH + FLEX
JAVA FX
JAVA FX?• An API included in Java SE 8
For UI development• The successor of Java Swing
WHY JAVA FX?• Rich Internet Application that Cross platform:
• Windows, Mac & Linux, Solaris, Arm, Mobile.
• Familiar: 100% Java APIs with millions Library
• Easy to Develop even for Beginner
• Drag and Drop Application
• Only use Java Language Programming
• GUI Development with Cross Platform
WHY JAVAFX ?
Productivity– Rapid Application Development using Tooling (Netbeans and
SceneBuilder)– Testing and…– We are coding only in Java
User Interface
WHY JAVAFX ?User Interface
Capability– Layouts built using WYSIWYG– Control Set (Basic and Advanced)– Eventing (e.g. Value Change Listeners, Thread State Listeners)– CSS styling
WHY JAVAFX ?FXML
VIEWS
Screen Building using Scene Builder which generates FXML
– Layout Containers– Place Controls– Associate Events– Style
Map to a Controller Class
FXML
Generates
Controller
Associate
JAVA PIONEERED RICH CLIENT APPLICATIONSBut developers had to learn multiple technologies
JAVAFX SIMPLIFIES APPLICATION DEVELOPMENTDevelopers Focus on Capabilities Instead of Technologies
LEARN THE BASIC
MINIMUM STANDARD TOOLS FOR EASY DEVELOPMENT
NETBEANS, ECLIPSE, ORACLE JDeveloper JDK 7 or 8 JDK 7 -> Java FX 2.2 (Separated Installer) JDK 8 -> JAVA FX 8 Included in Installer Scene Builder 2.0 Gloun Scene Builder 8.0
COMPONENT IN JAVA FX Containers
– Accordion, Anchor Pane, Stack Pane, Tab Pane, HBox, and VBox Controls
– Buttons, Choice Box, Combo Box, ImageView, WebView, TextField, TextArea, Label…
Shapes– Rectangle, Circle, Arc, Ellipse, Line, Polygon, Text, Cubic Curve
Charts – Area Chart, Bar Chart, Scatter Chart, Pie Chart, Bubble Chart
SCENE BUILDER, FXML, AND CONTROLLER
Scene Builder– Drag and Drop Application for Layout GUI
FXML– Script layout GUI that generated from Scene Builder
Controller– In Order FXML be dynamic content need Controller to
control components
HOW TO START?
HOW TO START?
You can start with learn in Java FX Sample Demo using Ensemble8 for JDK 8.
Read my book, JavaFX essentials (Packt 2015) by Mohamed Taman.
An Amazing book, JavaFX 8: Introduction by Example, Second Edition,Carl Dea, Mark Heckler, Gerrit Grunwald, José Pereda, and Sean M. Phillips (Apress, 2014. ISBN: 978-1-4302-6460-6)
Oracle website: http://docs.oracle.com/javase/8/javase-clienttechnologies.htm
DEMOS
JAVAFX ON MOBILE
JAVAFX ON MOBILE
Based on the official support from Oracle Corporation for JavaFX, a number of people inside the JavaFX community are working to port JavaFX to make it run on as many devices and platforms as possible (desktop, mobile, and embedded) and different operating systems, with the same codebase.
They have successfully created SDKs that allow us to develop JavaFX applications as native applications to run on Android or iOS-based devices in one bundle (JVM plus application)
JAVAFX ON MOBILE
JavaFX applications on iOS using the port from RoboVM (http://www.robovm.org/) and on Android using the port from JavaFXPorts (http://javafxports.org/).
For interoperability with Android native API the FXActivity class, is the bridge between JavaFX and the Dalvik runtime.
JAVAFX ON MOBILE
Now a single plugin called jfxmobile-plugin allows us to build applications for three platforms desktop, Android, and iOS from the same codebase.
JAVAFX ON MOBILE ANDROID VERSION
JAVAFX ON MOBILE iOS VERSION
JAVAFX ON RASPBERRY PI
JAVAFX ON THE RASPBERRY PI
Very closely related to the IoT world, the Raspberry Pi is a credit card-sized microcomputer designed by the Raspberry Pi Foundation for experimentation and education.
JAVAFX ON THE RASPBERRY PI
What you should know about the Raspberry Pi is that it is nothing but a small computer. Small power requirements, small physical size, small memory, and most importantly a low-cost device.
Everything about it is small, but it is still just a computer and it uses Linux.
JAVAFX ON THE RASPBERRY PI
Java was made for IoT from the first day of its invention.
Java was created with a clear vision in mind: to control small devices such as television set-top boxes.
With the explosion of IoT, Java returns to its roots.
JAVAFX ON THE RASPBERRY PI
You may think that JavaFX, a platform for rich-client development, would miss the IoT party—but it is not so! According to the JavaFX Overview page on the Oracle Technology Network:
– "It is designed to provide a lightweight, hardware-accelerated Java UI platform"
This statement holds the key to graphically rich-and-powerful JavaFX: hardware acceleration and; luckily, the Raspberry Pi comes with a powerful GPU.
JAVAFX ON THE RASPBERRY PI
JAVAFX ON THE RASPBERRY PI
JAVAFX WITH ARDUINO
JAVAFX WITH ARDUINO
Arduino is an open source electronics tool based on a simple programmable microcontroller board that can be programmed using a free open source IDE.
JAVAFX WITH ARDUINO
Alone or attached to a computer, it creates interactive devices that can sense by taking inputs from a variety of switches or sensors and can act by controlling a variety of lights, motors, and other outputs physical devices.
JAVAFX WITH ARDUINO
Arduino runs standalone or can communicate with software running on your computer (Java, JavaFX, Python, and so on) and the boards can be assembled by hand or purchased preassembled.
JAVAFX WITH ARDUINO (DEMO)
A desktop application using JavaFX along with an Arduino board in order to monitor data coming from a real world temperature sensor and report it on a chart,
How HOT blooded you really are!
JAVAFX WITH ARDUINO (DEMO)
JAVAFX WITH ARDUINO (DEMO)
JAVAFX WITH ARDUINO (THREADING)
The main use of Platform.runLater() is placing the task of filling the series data with the incoming Arduino input in the JavaFX thread.
Also it gives the required time to the Scene graph to render the chart, skipping values if they are added too fast.
TOUCHLESS JAVAFX APPS
TOUCHLESS JAVAFX APPS
Every day we notice the rise of input interfaces that are less mouse-centric and more in favor of touchless input.
Gestures are one of the ways humans can communicate with machines naturally these days.
TOUCHLESS JAVAFX APPS
There are several devices on the market that actually allow us to interact with computers using just some parts of our body: many games for the Xbox, the Microsoft game console, use the Kinect controller to recognize the user's body movements.
The myoelectric armband detects movements in your muscles and translates them into gestures so that you can interact with your computer.
Leap Motion controller recognizes users' hands and fingers and translate the movements and gestures to the computer.
TOUCHLESS JAVAFX APPS (LEAP MOTION)
Here is a very tiny device with 13 mm height, 30 mm width, 76 mm depth, and a weight of 45 grams (final dimensions: 0.5" x 1.2" x 3").
With the Leap Motion software running on your computer, just plug the controller into the USB on your Mac or PC and you are ready to go (without any external power source).
TOUCHLESS JAVAFX APPS (DEMO 3D)
RESOURCES JavaFX website: http://javafx.com Open source project
http://openjdk.java.net/projects/openjfx/ Oracle Premier Support for Software
http://www.oracle.com/us/support/software/premier/ Blogs
– http://fxexperience.com– http://blogs.oracle.com/javafx
Book, JavaFX essentials 2015 by Mohamed Taman. Oracle website: http://docs.oracle.com/javase/8/javase-clienttechnologies.htm
THANK YOU