JAVA FX INTRODUCTION Flashcards
What is javaFX?
• JavaFX is a Java library used to build Rich Internet Applications.
What is the advantage of using javaFX?
• JavaFX includes Media, UI controls, Web, 2D and 3D, etc. all these
features in a single library.
• Allows access of existing features of a Java library such as Swings.
• Provides a rich set of graphics and media API’s and it leverages the
modern Graphical Processing Unit through hardware accelerated
graphics.
• Provides interfaces using which developers can combine graphics
animation and UI control.
• One can use JavaFX with JVM based technologies such as Java, Groovy
and JRuby.
• The applications written using this library can run consistently across
multiple platforms.
• The applications developed using JavaFX can run on various devices
such as Desktop Computers, Mobile Phones, TVs, Tablets, etc.
Give 5 features of javaFX
• Written in Java:
• The JavaFX library is written in Java and is available for the languages that
can be executed on a JVM, which include – Java, Groovy and JRuby. These
JavaFX applications are also platform independent.
• FXML:
• JavaFX features a language known as FXML, which is a HTML like
declarative markup language. The sole purpose of this language is to
define a user Interface.
• Scene Builder:
• JavaFX provides an application named Scene Builder. On integrating this
application in IDE’s such as Eclipse and NetBeans, the users can access a
drag and drop design interface, which is used to develop FXML
applications (just like Swing Drag & Drop and DreamWeaver Applications).
• Swing Interoperability: In a JavaFX application, you can embed Swing
content using the Swing Node class. Similarly, you can update the
existing Swing applications with JavaFX features like embedded web
content and rich graphics media.
• Built-in UI controls: JavaFX library caters UI controls using which we can
develop a full-featured application.
Give 5 features of javaFX(2)
• CSS like Styling: JavaFX provides a CSS like styling. By using this, you can
improve the design of your application with a simple knowledge of CSS.
• Canvas and Printing API: JavaFX provides Canvas, an immediate mode
style of rendering API. Within the package javafx.scene.canvas it holds a
set of classes for canvas, using which we can draw directly within an
area of the JavaFX scene. JavaFX also provides classes for Printing
purposes in the package javafx.print.
• Rich set of API’s: JavaFX library provides a rich set of API’s to develop GUI
applications, 2D and 3D graphics, etc. This set of API’s also includes
capabilities of Java platform. Therefore, using this API, you can access the
features of Java languages such as Generics, Annotations, Multithreading,
and Lambda Expressions. The traditional Java Collections library was
enhanced and concepts like observable lists and maps were included in it.
Using these, the users can observe the changes in the data models.
• Integrated Graphics library: JavaFX provides classes for 2d and 3d graphics.
• Graphics pipeline: JavaFX supports graphics based on the Hardware-
accelerated graphics pipeline known as Prism. When used with a supported
Graphic Card or GPU it offers smooth graphics. In case the system does not
support graphic card then prism defaults to the software rendering stack.
Give examples of important APIs used in javaFX
• javafx.animation: Contains classes to add transition based animations
such as fill, fade, rotate, scale and translation, to the JavaFX nodes.
• javafx.application: Contains a set of classes responsible for the JavaFX
application life cycle.
• javafx.css: Contains classes to add CSS–like styling to JavaFX GUI
applications.
• javafx.event: Contains classes and interfaces to deliver and handle
JavaFX events.
• javafx.geometry: Contains classes to define 2D objects and perform
operations on them.
• javafx.stage: This package holds the top level container classes for
JavaFX application.
• javafx.scene: This package provides classes and interfaces to support
the scene graph. In addition, it also provides sub-packages such as
canvas, chart, control, effect, image, input, layout, media, paint, shape,
text, transform, web, etc. There are several components that support
this rich API of JavaFX.
Draw a diagram showing JavaFX architecture
*See notes for pic
Briefly describe what a scene graph is
• A scene graph is a tree-like data structure (hierarchical) representing the
contents of a scene.
JavaFX GUI Applications are coded using a Scene Graph.
Scene Graph is the starting point of the construction of the GUI Application.
• It holds the (GUI) application primitives that are termed as nodes.
In general, a collection of nodes makes a scene graph. All these nodes are arranged in a
hierarchical order
What is a node and what are examples of types of nodes
A node is a visual/graphical object and it may include
i. Geometrical (Graphical) objects – (2D and 3D) such as circle, rectangle,
polygon, etc.
ii. UI controls – such as Button, Checkbox, Choice box, Text Area, etc.
iii. Containers – (layout panes) such as Border Pane, Grid Pane, Flow Pane, etc.
iv. Media elements – such as audio, video and image objects. In general, a
collection of nodes makes a scene graph. All these nodes are arranged in a
hierarchical order
- A node instance can be added to a scene graph only once. The nodes
of a scene graph can have Effects, Opacity, Transforms, Event
Handlers, Application Specific States.
Define the terms parent, root node, branch node and leaf node in this context
• Each node in the scene graph has a single parent, and the node which
does not contain any parents is known as the root node.
• In the same way, every node has one or more children, and the node
without children is termed as leaf node; a node with children is
termed as a branch node.
*See notes for pic
Describe the quantam toolkit
• It is an abstraction over the low-level components of Prism,
Glass, Media Engine, and Web Engine.
• It ties Prism and GWT together and makes them available to
JavaFX.
Describe prism as used in graphics
- A high performance hardware–accelerated graphical pipeline
- Used to render the graphics in JavaFX.
- Can render both 2-D and 3-D graphics.
When does prism use a software rendering path
• In case the hardware support for graphics on the system is not sufficient,
then Prism uses the software render path to process the graphics.
• When used with a supported Graphic Card or GPU, it offers smoother
graphics. Just in case the system does not support a graphic card, then Prism
defaults to the software rendering stack.
Describe GWT
Glass Windowing Toolkit (GWT) provides services to manage Windows, Timers, Surfaces and Event Queues.
• GWT connects the JavaFX Platform to the Native Operating System.
Briefly describe webview
• Using JavaFX, you can also embed HTML content in to a scene graph.
• WebView is the component of JavaFX which is used to process this content.
• It uses a technology called Web Kit, which is an internal open-source web
browser engine.
• This component supports different web technologies like HTML5, CSS,
JavaScript, DOM and SVG.
List the different capabilities of WebView
i. Render HTML content from local or remote URL.
ii. Support history and provide Back and Forward navigation.
iii. Reload the content.
iv. Apply effects to the web component.
v. Edit the HTML content.
vi. Execute JavaScript commands.
vii. Handle events.
viii. In general, using WebView, you can control web content from Java.