Java FX it is a part of jdk 1.8.0_65, that intended to replace Swing.
Java APIs. JavaFX is a Java library that consists of classes and interfaces that are written in Java code. The APIs are designed to be a friendly alternative to Java Virtual Machine (Java VM) languages, such as JRuby and Scala.
FXML and Scene Builder. FXML is an XML-based declarative markup language for constructing a JavaFX application user interface. A designer can code in FXML or use JavaFX Scene Builder to interactively design the graphical user interface (GUI). Scene Builder generates FXML markup that can be ported to an IDE where a developer can add the business logic.
WebView. A web component that uses WebKitHTML technology to make it possible to embed web pages within a JavaFX application. JavaScript running in WebView can call Java APIs, and Java APIs can call JavaScript running in WebView. Support for additional HTML5 features, including Web Sockets, Web Workers, and Web Fonts, and printing capabilities have been added in JavaFX 8. See
Adding HTML Content to JavaFX Applications.
Swing interoperability. Existing Swing applications can be updated with JavaFX features, such as rich graphics media playback and embedded Web content. The
SwingNode class, which enables you to embed Swing content into JavaFX applications, has been added in JavaFX 8. See the
SwingNode API javadocand
Embedding Swing Content in JavaFX Applications for more information.
Built-in UI controls and CSS. JavaFX provides all the major UI controls that are required to develop a full-featured application. Components can be skinned with standard Web technologies such as CSS. The DatePicker and TreeTableView UI controls are now available with the JavaFX 8 release. See
Using JavaFX UI Controls for more information. Also, the CSS Styleable* classes have become public API, allowing objects to be styled by CSS.
Modena theme. The Modena theme replaces the Caspian theme as the default for JavaFX 8 applications. The Caspian theme is still available for your use by adding the
setUserAgentStylesheet(STYLESHEET_CASPIAN) line in your Application start() method. For more information, see the
Modena blog at fxexperience.com
3D Graphics Features. The new API classes for
Shape3D (
Box, Cylinder, MeshView, and Sphere subclasses),
SubScene, Material, PickResult, LightBase (AmbientLight and
PointLight subclasses), and
SceneAntialiasing have been added to the 3D Graphics library in JavaFX 8. The
Camera API class has also been updated in this release. For more information, see the
Getting Started with JavaFX 3D Graphics document and the corresponding
API javadoc for
javafx.scene.shape.Shape3D,
javafx.scene.SubScene, javafx.scene.paint.Material, javafx.scene.input.PickResult, and
javafx.scene.SceneAntialiasing.
Canvas API. The Canvas API enables drawing directly within an area of the JavaFX scene that consists of one graphical element (node).
Printing API. The
javafx.print package has been added in Java SE 8 release and provides the public classes for the
JavaFX Printing API.
Rich Text Support. JavaFX 8 brings enhanced text support to JavaFX, including bi-directional text and complex text scripts, such as Thai and Hindu in controls, and multi-line, multi-style text in text nodes.
Multitouch Support. JavaFX provides support for multitouch operations, based on the capabilities of the underlying platform.
Hi-DPI support. JavaFX 8 now supports Hi-DPI displays.
Hardware-accelerated graphics pipeline. JavaFX graphics are based on the graphics rendering pipeline (Prism). JavaFX offers smooth graphics that render quickly through Prism when it is used with a supported graphics card or graphics processing unit (GPU). If a system does not feature one of the recommended GPUs supported by JavaFX, then Prism defaults to the software rendering stack.
High-performance media engine. The media pipeline supports the playback of web multimedia content. It provides a stable, low-latency media framework that is based on the GStreamer multimedia framework.
Self-contained application deployment model. Self-contained application packages have all of the application resources and a private copy of the Java and JavaFX runtimes. They are distributed as native installable packages and provide the same installation and launch experience as native applications for that operating system.
New features of JavaFX:
FXML is a scriptable, XML-based markup language for constructing Java object graphs. It provides a convenient alternative to constructing such graphs in procedural code, and is ideally suited to defining the user interface of a JavaFX application, since the hierarchical structure of an XML document closely parallels the structure of the JavaFX scene graph.
Simple FXML example:
<<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?><?import javafx.scene.control.*?><?import javafx.scene.layout.*?><AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Label layoutX="132.0" layoutY="154.0" text="myFirstFXMLLabel" />
<Button layoutX="322.0" layoutY="149.0" mnemonicParsing="false" text="myFirstFXMLButton" />
<CheckBox layoutX="192.0" layoutY="182.0" mnemonicParsing="false" text="myFirstFXMLCheckBox" />
</children>
</AnchorPane>
JavaFX Scene Builder is a visual layout tool that lets users quickly design JavaFX application user interfaces, without coding. Users can drag and drop UI components to a work area, modify their properties, apply style sheets, and the FXML code for the layout that they are creating is automatically generated in the background. The result is an FXML file that can then be combined with a Java project by binding the UI to the application’s logic.
As fact, Scene Builder generate FXML file of your application.
But FXML is a scriptable, XML-based markup language for constructing Java object graphs. Pay attention to MVC. All business logic implement in java classes. Structure of our simple FXML project.
JavaFX vs Swing
What difference between JavaFX and Swing? Read this article.
Комментариев нет:
Отправить комментарий