CS 213 SOFTWARE METHODOLOGY
LILY CHANG ASSOCIATE TEACHING PROFESSOR DEPARTMENT OF COMPUTER SCIENCE RUTGERS UNIVERSITY – NEW BRUNSWICK FALL 2021
JavaFX Basics
Copyright By PowCoder代写 加微信 powcoder
• JavaFXisasetofgraphicsandmediapackagesthatenablesdeveloperstodesign, create, test, debug, and deploy rich client applications that operate consistently across diverse platforms
• JavaFXlibraryiswrittenasaJavaAPI,JavaFXapplicationcodecanreferenceAPIs from any Java library: https://openjfx.io/javadoc/17/
• Download:https://gluonhq.com/products/javafx/(scrolldowntoversion17,SDK)
• Getting started with JavaFX: https://openjfx.io/openjfx-docs/
JavaFX Applications
• ThelookandfeelofJavaFXapplicationscanbecustomized
• CascadingStyleSheets(CSS)separateappearanceandstylefrom
implementation so that developers can concentrate on coding
• Graphicdesignerscaneasilycustomizetheappearanceand style of the application through the CSS
• DevelopthepresentationaspectsoftheUIintheFXML scripting language and use Java code for the application logic
• TodesignUIswithoutwritingcode,thenuseJavaFXSceneBuilder.
• SceneBuildercreatesFXMLmarkupthatcanbeportedtoan Integrated Development Environment (IDE) so that developers can add the business logic
• Download: https://gluonhq.com/products/scene-builder/
• ConfiguringtheSceneBuilderinIntelliJ: https://www.jetbrains.com/help/idea/opening-fxml-files-in- javafx-scene-builder.html
Key Features
• JavaAPIs.
• AJavalibrarythatconsistsofclassesandinterfacesthatarewritteninJavacode
• FXMLandSceneBuilder
• FXMLisanXML-baseddeclarativemarkuplanguageforconstructingaJavaFXapplicationuser
• AwebcomponentthatusesWebKitHTMLtechnologytomakeitpossibletoembedwebpageswithin
a JavaFX application
• JavaScriptrunninginWebViewcancallJavaAPIs,andJavaAPIscancallJavaScriptrunningin WebView Adding HTML Content to JavaFX Applications.
Key Features
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
Built-in UI controls and CSS
• Provides all the major UI controls that are required to develop a full-featured application
3D Graphics Features
• API classes for Shape3D (Box, Cylinder, MeshView, and Sphere subclasses), SubScene, Material, PickResult, LightBase (AmbientLight and PointLight subclasses), and SceneAntialiasing
Key Features
Canvas API
Printing API
Rich Text Support
Multitouch Support for handheld devices
Enables drawing directly within an area of the JavaFX scene that consists of one graphical element (node).
The javafx.print package provides the public classes for the JavaFX Printing API.
Enhanced text support to JavaFX, including bi-directional text and complex text scripts, and multi- line, multi-style text in text nodes
Provides support for multitouch operations, based on the capabilities of the underlying platform.
What can we build with JavaFX?
You can build many types of applications
Typically, they are network-aware applications that are deployed across multiple platforms and display information in a high-performance modern user interface that features audio, video, graphics, and animation
JavaFX vs. Swing and
When Java was introduced, the GUI classes were bundled in a library known as the Abstract Windows Toolkit (AWT), which is prone to platform-specific bugs
Swing replaced the AWT user-interface components where components are painted directly on canvases using Java code; it is designed for developing desktop GUI applications
JavaFX replaced Swing and is a newer GUI platform that incorporates modern GUI technologies to enable you to develop rich GUI applications
• Provides a multitouch support for touch-enabled devices such as tablets and smart phones, 2D, 3D, animation, and video and audio playback
• Oracle no longer supports JavaFX, which is now OpenFX: https://openjfx.io/
Working on JavaFX apps with your favorite IDE
• Download e(fx)clipse – must be 3.5 or later, current version is 3.6
• In Eclipse, select Help/Eclipse Marketplace, type “fx” and search
• This will give you the options of creating a JavaFX project under File/New/Project
IntelliJ and Eclipse
• Download JavaFX APIs – https://gluonhq.com/products/javafx/
• Download SceneBuilder to make the GUI programming easier
• https://gluonhq.com/products/scene-builder/#download
• IntelliJ – Preferences->Languages and Frameworks-
>JavaFX->Path to SceneBuilder
• Eclipse – Preferences->JavaFX->SceneBuilder Executable, then right click the .fxml file and open with SceneBuilder
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com