2.java Module5 Javafx Panes
2.java Module5 Javafx Panes
MODULE-5
Module - 5
GUI Programming and Database Connectivity (7 hours)
• Exploring events
10/16/2022 9:32:33 AM 2
What is JavaFX?
• JavaFX is a Java library used to build Rich Internet
Applications. The applications written using this library can run
consistently across multiple platforms.
JavaFX code can be embedded with the CSS to improve the style of the
CSS like styling application. We can enhance the view of our application with the simple
knowledge of CSS.
Features of JavaFX
Feature Description
The JavaFX applications can be embedded with swing code using the Swing
Swing interoperability Node class. We can update the existing swing application with the powerful
features of JavaFX.
Canvas API provides the methods for drawing directly in an area of a JavaFX
Canvas API
scene.
Rich Set of APIs JavaFX provides a rich set of API's to develop GUI applications.
Integrated Graphics
An integrated set of classes are provided to deal with 2D and 3D graphics.
Library
High Performance The media pipeline supports the playback of web multimedia on a low latency. It
Media Engine is based on a Gstreamer Multimedia framework.
Packages of JavaFX
• JavaFX provides a complete API with a rich set of classes and interfaces to
build GUI applications with rich graphics.
• The important packages of this API are −
– 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.
JAVA Application structure
Stage
• A stage (a window) contains all the objects of a
JavaFX application. It is represented by Stage class
of the package javafx.stage.
• A few notes:
– The “Add” button is right-aligned within its cell
– The whole frame is centered
– The labels get the default horizontal alignment of “left”
– We specify the column first (backwards from arrays)
– Not every cell needs to be filled
– Elements can be moved from one cell to another
The BorderPane
• The BorderPane divides the pane into five “regions”
• BorderPane class lays its children in top, bottom,
center, left and, right positions
• Pane is also a Node, so a Pane can contain another
Pane
The BorderPane
Methods Explanation
getAlignment(Node c) Returns the alignment of the node.