SlideShare a Scribd company logo
1 of 18
Download to read offline
Introduction of JavaFx
Prem Chand Mali
About Me
SCJP/OCJP - Oracle Certified Java Programmer
MCP:70-480 - Specialist certification in HTML5
with JavaScript and CSS3 Exam
Skills : Java, Swings, Springs,
Hibernate, JavaFX, Jquery,
prototypeJS, ExtJS.
Connect Me :
Facebook : https://www.facebook.com/prem.c.mali
LinkedIn: http://www.linkedin.com/in/premmali
Twitter: https://twitter.com/prem_mali
Google+ : https://plus.google.com/106150245941317924019/about/p/pub
Contact Me :
Email : premchandm@mindfiresolutions.com / prem.c.mali@gmail.com
Skype: mfsi_premchandm
Agenda


Event Handling.



Property and Bindings



WebView and MediaPlayer



Shapes



Bind event on shapes



Q&A
Event Handling


What is an event ?



Event types



Event targets



Event delivery process
What is an event ?
Event is occurrence which happens in application with or
without participation of human.


JavaFx events are instance of javafx.event.Event or
subclass of Event.




Event has following three properties.
– Event type : Type of event
– Source : Origin of the event, source changes as the
event is passed along the chain.
Target: No on which the action occurred
Event Type


An event type is an instance of the EventType class.
Event.Any

WindowEvent.Any

ActionEvent.Action

InputEvent.Any

WindowEvent.Showing

KeyEvent.Any

WindowEvent.Shown

KeyEvent.Key_Pressed

MouseEvent.Mouse_Presse
d

KeyEvent.Key_Release
d

MouseEvent.Mouse_Released

KeyEvent.Any

MouseEvent.Any

...
Event Target
• Target can be instance of any class that implements
EventTarget interface.
• Implementation of buildEventDispatchChain creates the
event dispatch chain that the event must travel to reach
target.
• Window, scene, node classes implement the EventTarget
interface and subclasses of those classes inherit the
implementation.
• If custom control is not subclass from Window, Scene, or
Node then you need to implement EventTarget.
Event delivery process
• Event delivery process contains following four steps
– Target Selection
– Route construction
– Event capturing
– Event bublling
Properties and Binding
• JavaBeans component architecture to represent the
property of an object. JavaFx expended and improved it.
• JavaFX properties are often used in conjunction with
binding, a powerful mechanism for expressing direct
relationships between variables.
• Properties classes is part of javafx.beans.property
package.
• A binding observes its list of dependencies for changes,
and then updates itself automatically after a change has
been detected. It is following two types of API
– High Level
– Low Level
Properties and Binding


Fluent API

IntegerProperty num1 = new SimpleIntegerProperty(1);
IntegerProperty num2 = new SimpleIntegerProperty(2);
NumberBinding sum = num1.add(num2);
System.out.println(sum.getValue());
num1.set(2);
System.out.println(sum.getValue());


Binding class

NumberBinding sum = Bindings.add(num1,num2);



Both Approach

Bindings.add(num1.multiply(num2),num3.multiply(num4));
Properties and Buinding


Low Level API example

DoubleBinding db = new DoubleBinding() {
{
super.bind(a, b, c, d);
}
@Override
protected double computeValue() {
return (a.get() * b.get()) + (c.get() * d.get());
}
};
WebView
The WebView component is based on WebKit, an open
source web browser engine. It supports Cascading Style
Sheets (CSS), JavaScript, Document Object Model (DOM),
and HTML5.


It enables you to perform following tasks.
–
–
–
–
–
–

Render HTML content from local and remote URLs
Obtain Web history
Execute JavaScript commands
Perform upcalls from JavaScript to JavaFX
Manage web pop-up windows
Apply effects to the embedded browser
Media
The javafx.scene.media package enables developers to
create media applications that provide media playback in
the desktop window or within a web page on supported
platforms.


Currently supported formats.
– Audio: MP3; AIFF containing uncompressed PCM;
WAV containing uncompressed PCM; MPEG-4
multimedia container with Advanced Audio Coding
(AAC) audio
– Video: FLV containing VP6 video and MP3 audio;
MPEG-4 multimedia container with H.264/AVC
(Advanced Video Coding) video compression.
Media
Some of the features supported by the JavaFX media
stack include the following


–
–
–
–
–
–
–
–



FLV container with MP3 and VP6
MP3 audio
MPEG-4 container with either AAC, H.264, or both
HTTP, FILE protocol support
Progressive download
Seeking
Buffer progress
Playback functions (Play, Pause, Stop, Volume,
Mute, Balance, Equalizer)

Media components
– Media – A media resource, containing information
about the media, such as its source, resolution, and
metadata.
– MediaPlayer – The key component providing the
controls for playing media.
Media
Media components
– MediaView – A Node object to support animation,
translucency, and effects
Shapes
• JavaFx also provided capability to draw following shapes
on scene.
– Circle
– Rectangle
– Ellipse
– Line
– Polygon
– etc
Events on Shapes
• JavaFx Shape API also provide capability to add event on
Shapes.
For example :
rect.setOnMouseClicked(new
EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
Color color = (((Color)
rect.getFill()).equals(Color.RED))
? Color.BROWN : Color.RED;
rect.setFill(color);
}
});
Q&A

More Related Content

What's hot

MV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaMV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaYi-Shou Chen
 
JAVA Training Syllabus Course
JAVA Training Syllabus CourseJAVA Training Syllabus Course
JAVA Training Syllabus CourseTOPS Technologies
 
Lecture java basics
Lecture   java basicsLecture   java basics
Lecture java basicseleksdev
 
J2EE Struts with Hibernate Framework
J2EE Struts with Hibernate FrameworkJ2EE Struts with Hibernate Framework
J2EE Struts with Hibernate Frameworkmparth
 
CR Bridge Solutions Pvt Ltd. Java slides
CR Bridge Solutions Pvt Ltd. Java slidesCR Bridge Solutions Pvt Ltd. Java slides
CR Bridge Solutions Pvt Ltd. Java slidesCRBTech
 
Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5Devang Garach
 
Ad103 - Have it Your Way: Extending IBM Lotus Domino Designer
Ad103 - Have it Your Way: Extending IBM Lotus Domino DesignerAd103 - Have it Your Way: Extending IBM Lotus Domino Designer
Ad103 - Have it Your Way: Extending IBM Lotus Domino Designerddrschiw
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technologysshhzap
 

What's hot (20)

MV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaMV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoa
 
JAVA Training Syllabus Course
JAVA Training Syllabus CourseJAVA Training Syllabus Course
JAVA Training Syllabus Course
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Lecture java basics
Lecture   java basicsLecture   java basics
Lecture java basics
 
J2EE Struts with Hibernate Framework
J2EE Struts with Hibernate FrameworkJ2EE Struts with Hibernate Framework
J2EE Struts with Hibernate Framework
 
CR Bridge Solutions Pvt Ltd. Java slides
CR Bridge Solutions Pvt Ltd. Java slidesCR Bridge Solutions Pvt Ltd. Java slides
CR Bridge Solutions Pvt Ltd. Java slides
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Java 1
Java 1Java 1
Java 1
 
Spring presentation
Spring presentationSpring presentation
Spring presentation
 
Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5Overview of React.JS - Internship Presentation - Week 5
Overview of React.JS - Internship Presentation - Week 5
 
Java introduction
Java introductionJava introduction
Java introduction
 
Ad103 - Have it Your Way: Extending IBM Lotus Domino Designer
Ad103 - Have it Your Way: Extending IBM Lotus Domino DesignerAd103 - Have it Your Way: Extending IBM Lotus Domino Designer
Ad103 - Have it Your Way: Extending IBM Lotus Domino Designer
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
Core java course syllabus
Core java course syllabusCore java course syllabus
Core java course syllabus
 
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
 
Chapter 1 introduction to java technology
Chapter 1 introduction to java technologyChapter 1 introduction to java technology
Chapter 1 introduction to java technology
 
Java seminar
Java seminarJava seminar
Java seminar
 
Features of java
Features of javaFeatures of java
Features of java
 
Netbeans IDE & Platform
Netbeans IDE & PlatformNetbeans IDE & Platform
Netbeans IDE & Platform
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 

Similar to Java FX Part2

Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hourConvert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hourBrian Culver
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
Stanfy - Crafting Custom Software Systems
Stanfy - Crafting Custom Software SystemsStanfy - Crafting Custom Software Systems
Stanfy - Crafting Custom Software SystemsDmytro Karamshuk
 
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatCase Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatVMware Hyperic
 
Introduction to YII framework
Introduction to YII frameworkIntroduction to YII framework
Introduction to YII frameworkNaincy Gupta
 
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)Brian Culver
 
Developer 2: Building A DevOps Toolchain
Developer 2: Building A DevOps ToolchainDeveloper 2: Building A DevOps Toolchain
Developer 2: Building A DevOps ToolchainInflectra
 
Shahnawaz Md Test Engineer
Shahnawaz Md Test EngineerShahnawaz Md Test Engineer
Shahnawaz Md Test EngineerShahnawaz Md
 
Rajiv ranjan resume-us
Rajiv ranjan  resume-usRajiv ranjan  resume-us
Rajiv ranjan resume-usRajiv Ranjan
 
AWS Summit Auckland - Application Delivery Patterns for Developers
AWS Summit Auckland - Application Delivery Patterns for DevelopersAWS Summit Auckland - Application Delivery Patterns for Developers
AWS Summit Auckland - Application Delivery Patterns for DevelopersAmazon Web Services
 
Part6 introducing the jas forge collaborative project
Part6   introducing the jas forge collaborative projectPart6   introducing the jas forge collaborative project
Part6 introducing the jas forge collaborative projectJasmine Conseil
 
Jesy George_CV_LATEST
Jesy George_CV_LATESTJesy George_CV_LATEST
Jesy George_CV_LATESTJesy George
 
20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache MavenArnaud Héritier
 
Near real-time anomaly detection at Lyft
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyftmarkgrover
 

Similar to Java FX Part2 (20)

Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hourConvert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
XPages Mobile, #dd13
XPages Mobile, #dd13XPages Mobile, #dd13
XPages Mobile, #dd13
 
Stanfy - Crafting Custom Software Systems
Stanfy - Crafting Custom Software SystemsStanfy - Crafting Custom Software Systems
Stanfy - Crafting Custom Software Systems
 
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache TomcatCase Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
Case Study: Migrating Hyperic from EJB to Spring from JBoss to Apache Tomcat
 
Mayur_Resume (2) (1)
Mayur_Resume (2) (1)Mayur_Resume (2) (1)
Mayur_Resume (2) (1)
 
Introduction to YII framework
Introduction to YII frameworkIntroduction to YII framework
Introduction to YII framework
 
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
Developer 2: Building A DevOps Toolchain
Developer 2: Building A DevOps ToolchainDeveloper 2: Building A DevOps Toolchain
Developer 2: Building A DevOps Toolchain
 
Pavani_Rao
Pavani_RaoPavani_Rao
Pavani_Rao
 
SFDC_BRAJ
SFDC_BRAJSFDC_BRAJ
SFDC_BRAJ
 
Maven
MavenMaven
Maven
 
Shahnawaz Md Test Engineer
Shahnawaz Md Test EngineerShahnawaz Md Test Engineer
Shahnawaz Md Test Engineer
 
Rajiv ranjan resume-us
Rajiv ranjan  resume-usRajiv ranjan  resume-us
Rajiv ranjan resume-us
 
AWS Summit Auckland - Application Delivery Patterns for Developers
AWS Summit Auckland - Application Delivery Patterns for DevelopersAWS Summit Auckland - Application Delivery Patterns for Developers
AWS Summit Auckland - Application Delivery Patterns for Developers
 
Part6 introducing the jas forge collaborative project
Part6   introducing the jas forge collaborative projectPart6   introducing the jas forge collaborative project
Part6 introducing the jas forge collaborative project
 
Lova_Resume_SSE
Lova_Resume_SSELova_Resume_SSE
Lova_Resume_SSE
 
Jesy George_CV_LATEST
Jesy George_CV_LATESTJesy George_CV_LATEST
Jesy George_CV_LATEST
 
20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven20091112 - Mars Jug - Apache Maven
20091112 - Mars Jug - Apache Maven
 
Near real-time anomaly detection at Lyft
Near real-time anomaly detection at LyftNear real-time anomaly detection at Lyft
Near real-time anomaly detection at Lyft
 

More from Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Recently uploaded

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Java FX Part2

  • 2. About Me SCJP/OCJP - Oracle Certified Java Programmer MCP:70-480 - Specialist certification in HTML5 with JavaScript and CSS3 Exam Skills : Java, Swings, Springs, Hibernate, JavaFX, Jquery, prototypeJS, ExtJS. Connect Me : Facebook : https://www.facebook.com/prem.c.mali LinkedIn: http://www.linkedin.com/in/premmali Twitter: https://twitter.com/prem_mali Google+ : https://plus.google.com/106150245941317924019/about/p/pub Contact Me : Email : premchandm@mindfiresolutions.com / prem.c.mali@gmail.com Skype: mfsi_premchandm
  • 3. Agenda  Event Handling.  Property and Bindings  WebView and MediaPlayer  Shapes  Bind event on shapes  Q&A
  • 4. Event Handling  What is an event ?  Event types  Event targets  Event delivery process
  • 5. What is an event ? Event is occurrence which happens in application with or without participation of human.  JavaFx events are instance of javafx.event.Event or subclass of Event.   Event has following three properties. – Event type : Type of event – Source : Origin of the event, source changes as the event is passed along the chain. Target: No on which the action occurred
  • 6. Event Type  An event type is an instance of the EventType class. Event.Any WindowEvent.Any ActionEvent.Action InputEvent.Any WindowEvent.Showing KeyEvent.Any WindowEvent.Shown KeyEvent.Key_Pressed MouseEvent.Mouse_Presse d KeyEvent.Key_Release d MouseEvent.Mouse_Released KeyEvent.Any MouseEvent.Any ...
  • 7. Event Target • Target can be instance of any class that implements EventTarget interface. • Implementation of buildEventDispatchChain creates the event dispatch chain that the event must travel to reach target. • Window, scene, node classes implement the EventTarget interface and subclasses of those classes inherit the implementation. • If custom control is not subclass from Window, Scene, or Node then you need to implement EventTarget.
  • 8. Event delivery process • Event delivery process contains following four steps – Target Selection – Route construction – Event capturing – Event bublling
  • 9. Properties and Binding • JavaBeans component architecture to represent the property of an object. JavaFx expended and improved it. • JavaFX properties are often used in conjunction with binding, a powerful mechanism for expressing direct relationships between variables. • Properties classes is part of javafx.beans.property package. • A binding observes its list of dependencies for changes, and then updates itself automatically after a change has been detected. It is following two types of API – High Level – Low Level
  • 10. Properties and Binding  Fluent API IntegerProperty num1 = new SimpleIntegerProperty(1); IntegerProperty num2 = new SimpleIntegerProperty(2); NumberBinding sum = num1.add(num2); System.out.println(sum.getValue()); num1.set(2); System.out.println(sum.getValue());  Binding class NumberBinding sum = Bindings.add(num1,num2);  Both Approach Bindings.add(num1.multiply(num2),num3.multiply(num4));
  • 11. Properties and Buinding  Low Level API example DoubleBinding db = new DoubleBinding() { { super.bind(a, b, c, d); } @Override protected double computeValue() { return (a.get() * b.get()) + (c.get() * d.get()); } };
  • 12. WebView The WebView component is based on WebKit, an open source web browser engine. It supports Cascading Style Sheets (CSS), JavaScript, Document Object Model (DOM), and HTML5.  It enables you to perform following tasks. – – – – – – Render HTML content from local and remote URLs Obtain Web history Execute JavaScript commands Perform upcalls from JavaScript to JavaFX Manage web pop-up windows Apply effects to the embedded browser
  • 13. Media The javafx.scene.media package enables developers to create media applications that provide media playback in the desktop window or within a web page on supported platforms.  Currently supported formats. – Audio: MP3; AIFF containing uncompressed PCM; WAV containing uncompressed PCM; MPEG-4 multimedia container with Advanced Audio Coding (AAC) audio – Video: FLV containing VP6 video and MP3 audio; MPEG-4 multimedia container with H.264/AVC (Advanced Video Coding) video compression.
  • 14. Media Some of the features supported by the JavaFX media stack include the following  – – – – – – – –  FLV container with MP3 and VP6 MP3 audio MPEG-4 container with either AAC, H.264, or both HTTP, FILE protocol support Progressive download Seeking Buffer progress Playback functions (Play, Pause, Stop, Volume, Mute, Balance, Equalizer) Media components – Media – A media resource, containing information about the media, such as its source, resolution, and metadata. – MediaPlayer – The key component providing the controls for playing media.
  • 15. Media Media components – MediaView – A Node object to support animation, translucency, and effects
  • 16. Shapes • JavaFx also provided capability to draw following shapes on scene. – Circle – Rectangle – Ellipse – Line – Polygon – etc
  • 17. Events on Shapes • JavaFx Shape API also provide capability to add event on Shapes. For example : rect.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Color color = (((Color) rect.getFill()).equals(Color.RED)) ? Color.BROWN : Color.RED; rect.setFill(color); } });
  • 18. Q&A