Introduction of JavaFx
Prem Chand Mali
About Me
SCJP/OCJP - Oracle Certified Java Programmer
MCP:70-480 - Specialist certification in HTML5
with JavaScript and C...
Agenda


JavaFx Introduction.



Requirements for JavaFX application development.



HelloWorld application with Netbea...
JavaFx Introduction
JavaFx is a software platform for creating and delivering
rich internet application (RIAs) that can ru...
Requirements for JavaFX application development
JavaFX 2.2.5 libraries are installed with JDK 7u11 for all
supported opera...
HelloWorld in JavaFX with Netbeans
Example is created on Netbeans 7.1.2


Goto → File Menu and choose New Project

In the...
HelloWorld in JavaFX with Netbeans
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.c...
HelloWorld in JavaFX with Netbeans
//Creating label and setting the text.
Label lbl = new Label();
lbl.setText("Say 'Hello...
Introduction of following key classes.
Application

Stage

Scene

Application
Every JavaFx application needs to extend this abstract
class. This is the entry point of the JavaFx applicatio...
Application
Values can be passed to JavaFx application. Application
parameters are available by calling the getParameters(...
Stage
The JavaFX Stage class is the top level JavaFX container.
The primary Stage is constructed by the platform.
Addition...
Scene
The JavaFX Scene class is the container for all content in a
scene graph. The background of the scene is filled as
s...
JavaFx UI Controls
The JavaFX UI controls are built by using nodes in the
scene graph. Therefore, the controls can use the...
JavaFx UI Controls
- Separator
- Slider
- Progress Bar and Progress Indicator
- Hyperlink
- Tooltip
- HTML Editor
- Titled...
Layouts
- BorderPane
- HBox
- VBox
- StackPane
- GridPane
- FlowPane
- AnchorPane
- TilePane
Event Handling
An event represents an occurrence of something of
interest to the application, such as a mouse being moved
...
Q&A
Upcoming SlideShare
Loading in …5
×

Introduction to JavaFX

1,253 views

Published on

JavaFX is a set of graphics and media packages that enables developers to design, create, test, debug, and deploy rich client applications that operate consistently across diverse platforms.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,253
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
36
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Introduction to JavaFX

  1. 1. Introduction of JavaFx Prem Chand Mali
  2. 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. 3. Agenda  JavaFx Introduction.  Requirements for JavaFX application development.  HelloWorld application with Netbeans.  Introduction of Application, stage and scene key classes.  UI controls  Layout Panes  Event Handling  Q&A
  4. 4. JavaFx Introduction JavaFx is a software platform for creating and delivering rich internet application (RIAs) that can run across a wide variety of devices.  Before version 2.0 of JavaFx, it was JavaFX was scripting language to build JavaFX application.  JavaFx 2.0 and later is now implemented as a native Java library and JavaFX Script has been scrapped by Oracle, but development is being continue in the Visage project.  JavaFx 2.x does not support the Solaris operating system or mobile phones; however as plans to integrate JavaFX to Java SE embedded 8, JavaFx for ARM processors is currently in developer preview phase. 
  5. 5. Requirements for JavaFX application development JavaFX 2.2.5 libraries are installed with JDK 7u11 for all supported operating systems. Note that Apple's Java SE implementation is not supported with JavaFX.  For JDK 6 you need to use standalone JavaFX 2.2.5 installation.  Browser support IE7, 8, 9, 10, firefox 3.6+, chrome latest and safari 5.1+   Graphics support NVIDIA, ATI, Intel.  You can use Netbeans, Eclipse, IntealiJ and etc.
  6. 6. HelloWorld in JavaFX with Netbeans Example is created on Netbeans 7.1.2  Goto → File Menu and choose New Project In the JavaFX application category, choose JavaFX Application. Click Next   Name the project HelloWorld and click Finish You will have HelloWorld.java class where you can put following code and run the application. 
  7. 7. HelloWorld in JavaFX with Netbeans import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { //Setting the Title of window. primaryStage.setTitle("Hello World!");
  8. 8. HelloWorld in JavaFX with Netbeans //Creating label and setting the text. Label lbl = new Label(); lbl.setText("Say 'Hello World'"); //Creating the stackpane for layout and adding label into it. StackPane root = new StackPane(); root.getChildren().add(lbl); //Creating and setting the scene. primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); } }
  9. 9. Introduction of following key classes. Application  Stage  Scene 
  10. 10. Application Every JavaFx application needs to extend this abstract class. This is the entry point of the JavaFx application.  JavaFx runtime does the following, in order, whenever an application id launched. - Constructs an instance of the specified Application class. - Calls the init() method. - Calls the start(javafx.stage.Stage) method. - Waits for the application to finish, which happens when either of the following occur: a.) the application calls Platform.exit() b.) the last window has been closed and the implicitExit attribute on Platform is true. - Calls the stop() method  start method is abstract and must be overridden. The init and stop methods have concrete implementations that do nothing. 
  11. 11. Application Values can be passed to JavaFx application. Application parameters are available by calling the getParameters() method from the init() method, or any time after the init method has been called.  JavaFX creates an application thread for running the application start method, processing input events, and running animation timelines. Creation of JavaFX Scene and Stage objects as well as modification of scene graph operations to live objects (those objects already attached to a scene) must be done on the JavaFX application thread. 
  12. 12. Stage The JavaFX Stage class is the top level JavaFX container. The primary Stage is constructed by the platform. Additional Stage objects may be constructed by the application.  Stage objects must be constructed and modified on the JavaFX Application Thread.  A stage can optionally have an owner Window. When a window is a stage's owner, it is said to be the parent of that stage. When a parent window is closed, all its descendant windows are closed. The same chained behavior applied for a parent window that is iconified. A stage will always be on top of its parent window. The owner must be initialized before the stage is made visible. 
  13. 13. Scene The JavaFX Scene class is the container for all content in a scene graph. The background of the scene is filled as specified by the fill property.  The application must specify the root Node for the scene graph by setting the root property.   A scene graph is a tree data structure.
  14. 14. JavaFx UI Controls The JavaFX UI controls are built by using nodes in the scene graph. Therefore, the controls can use the visually rich features of the JavaFX platform. Here are following controls.  - Label - Button - Radio Button - Toggle Button - Checkbox - Choice Box - Text Field - Password Field - Scroll Bar - Scroll Pane - List View - Table View - Tree View - Combo Box
  15. 15. JavaFx UI Controls - Separator - Slider - Progress Bar and Progress Indicator - Hyperlink - Tooltip - HTML Editor - Titled Pane and Accordion - Menu - Color Picker - Pagination Control - File Chooser
  16. 16. Layouts - BorderPane - HBox - VBox - StackPane - GridPane - FlowPane - AnchorPane - TilePane
  17. 17. Event Handling An event represents an occurrence of something of interest to the application, such as a mouse being moved or a key being pressed.  - Mouse Event - Key Event - Touch Event - Gesture
  18. 18. Q&A

×