JavaFX - Oracle

3y ago
66 Views
12 Downloads
1.29 MB
68 Pages
Last View : 29d ago
Last Download : 3m ago
Upload by : Tripp Mcmullen
Transcription

JavaFXGetting Started with JavaFXRelease 8E50607-02August 2014Get started with JavaFX by getting an overview of theavailable features, learning the architecture, and creatingsimple applications that introduce you to layouts, CSS,FXML, visual effects, and animation.

JavaFX Getting Started with JavaFX, Release 8E50607-02Copyright 2008, 2014, Oracle and/or its affiliates. All rights reserved.Contributing Author:Jasper Potts, Nancy Hildebrandt, Joni Gordon, Cindy CastilloThis software and related documentation are provided under a license agreement containing restrictions onuse and disclosure and are protected by intellectual property laws. Except as expressly permitted in yourlicense agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverseengineering, disassembly, or decompilation of this software, unless required by law for interoperability, isprohibited.The information contained herein is subject to change without notice and is not warranted to be error-free. Ifyou find any errors, please report them to us in writing.If this is software or related documentation that is delivered to the U.S. Government or anyone licensing iton behalf of the U.S. Government, the following notice is applicable:U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,any programs installed on the hardware, and/or documentation, delivered to U.S. Government end usersare "commercial computer software" pursuant to the applicable Federal Acquisition Regulation andagency-specific supplemental regulations. As such, use, duplication, disclosure, modification, andadaptation of the programs, including any operating system, integrated software, any programs installed onthe hardware, and/or documentation, shall be subject to license terms and license restrictions applicable tothe programs. No other rights are granted to the U.S. Government.This software or hardware is developed for general use in a variety of information managementapplications. It is not developed or intended for use in any inherently dangerous applications, includingapplications that may create a risk of personal injury. If you use this software or hardware in dangerousapplications, then you shall be responsible to take all appropriate failsafe, backup, redundancy, and othermeasures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damagescaused by use of this software or hardware in dangerous applications.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks oftheir respective owners.Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarksare used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of AdvancedMicro Devices. UNIX is a registered trademark of The Open Group.This software or hardware and documentation may provide access to or information on content, products,and services from third parties. Oracle Corporation and its affiliates are not responsible for and expresslydisclaim all warranties of any kind with respect to third-party content, products, and services. OracleCorporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to youraccess to or use of third-party content, products, or services.

ContentsPreface . viiAbout This Tutorial. viiAudience. viiDocumentation Accessibility . viiRelated Documents . viiConventions . viiiWhat’s New . ixPart IWhat Is JavaFX?1 JavaFX OverviewJavaFX Applications. 1-1Availability . 1-2Key Features . 1-2What Can I Build with JavaFX? . 1-3How Do I Run a Sample Application?. 1-4How Do I Run a Sample in an IDE? . 1-5How Do I Create a JavaFX Application? . 1-5Resources . 1-62 Understanding the JavaFX ArchitectureScene Graph . 2-2Java Public APIs for JavaFX Features . 2-2Graphics System. 2-3Glass Windowing Toolkit . 2-3Threads .2-4Pulse .2-4Media and Images . 2-4Web Component . 2-5CSS . 2-5UI Controls . 2-6Layout . 2-72-D and 3-D Transformations. 2-8Visual Effects. 2-8iii

Part II Getting Started with JavaFX Sample Applications3 Hello World, JavaFX StyleConstruct the Application. 3-1Run the Application. 3-3Where to Go Next . 3-34 Creating a Form in JavaFXCreate the Project. 4-1Create a GridPane Layout . 4-2Add Text, Labels, and Text Fields. 4-3Add a Button and Text . 4-4Add Code to Handle an Event . 4-5Run the Application. 4-5Where to Go from Here . 4-65 Fancy Forms with JavaFX CSSCreate the Project. 5-1Create the CSS File. 5-2Add a Background Image . 5-2Style the Labels. 5-3Style Text . 5-4Style the Button . 5-5Where to Go from Here . 5-76 Using FXML to Create a User InterfaceSet Up the Project . 6-1Load the FXML Source File . 6-2Modify the Import Statements . 6-2Create a GridPane Layout . 6-3Add Text and Password Fields. 6-3Add a Button and Text . 6-5Add Code to Handle an Event . 6-5Use a Scripting Language to Handle Events . 6-6Style the Application with CSS. 6-7Where to Go from Here . 6-87 Animation and Visual Effects in JavaFXSet Up the Application . 7-2Set Up the Project . 7-2Add Graphics . 7-3Add a Visual Effect. 7-4Create a Background Gradient . 7-5Apply a Blend Mode. 7-6Add Animation . 7-7iv

Where to Go from Here . 7-8background.jpg. A-2v

vi

PrefaceThis preface gives an overview about this tutorial and also describes the documentaccessibility features and conventions used in this tutorial - Getting Started with JavaFXAbout This TutorialThis tutorial is a compilation of three documents that were previously delivered withthe JavaFX 2.x documentation set: JavaFX Overview, JavaFX Architecture, and GettingStarted with JavaFX. The combined content has been enhanced with updatedinformation about the new JavaFX features included with the Java SE 8 release. Thisdocument contains the following parts: What Is JavaFX? Getting Started with JavaFX Sample ApplicationsEach part contains chapters that introduce you to the JavaFX technology and gets youstarted in learning how to use it for your application development.AudienceThis document is intended for JavaFX developers.Documentation AccessibilityFor information about Oracle's commitment to accessibility, visit the OracleAccessibility Program website athttp://www.oracle.com/pls/topic/lookup?ctx acc&id docacc.Access to Oracle SupportOracle customers have access to electronic support through My Oracle Support. Forinformation, visithttp://www.oracle.com/pls/topic/lookup?ctx acc&id info or visithttp://www.oracle.com/pls/topic/lookup?ctx acc&id trs if you arehearing impaired.Related DocumentsFor more information, see the rest of the JavaFX documentation set ologies.htm.vii

ConventionsThe following text conventions are used in this document:viiiConventionMeaningboldfaceBoldface type indicates graphical user interface elements associatedwith an action, or terms defined in text or the glossary.italicItalic type indicates book titles, emphasis, or placeholder variables forwhich you supply particular values.monospaceMonospace type indicates commands within a paragraph, URLs, codein examples, text that appears on the screen, or text that you enter.

What’s NewThis chapter summarizes the new features and significant product changes made inthe JavaFX component of the Java SE 8 release. The new Modena theme is now the default theme for JavaFX applications. See theModena theme section of Key Features.Support for additional HTML5 features has been added. See Adding HTMLContent to JavaFX Applications for more information.The new SwingNode class improves the Swing interoperability feature. SeeEmbedding Swing Content in JavaFX Applications.New built-in UI controls, DatePicker and TableView, are now available. See UsingJavaFX UI Controls document for more information.3D Graphics library has been enhanced with several new API classes. See 3DGraphics features section of Key Features and Getting Started with JavaFX 3DGraphics for more information.The javafx.print package is now available and provides the public JavaFXprinting APIs. Rich text support has been added. Support for Hi-DPI displays have been made available. CSS styleable classes became public APIs. Scheduled service class has been introduced.ix

x

Part IPart IPart I contains the following chapters: JavaFX Overview Understanding the JavaFX ArchitectureWhat Is JavaFX?

1JavaFX Overview1This chapter provides an overview of the types of applications you can build usingJavaFX APIs, where to download the JavaFX libraries, and a high level informationabout the key JavaFX features being delivered.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 acrossdiverse platforms. JavaFX Applications Availability Key Features What Can I Build with JavaFX? How Do I Run a Sample Application? How Do I Run a Sample in an IDE? How Do I Create a JavaFX Application? ResourcesSee the Understanding the JavaFX Architecture chapter to learn about the JavaFXplatform architecture and to get a brief description of the JavaFX APIs for mediastreaming, web rendering, and user interface styling.JavaFX ApplicationsSince the JavaFX library is written as a Java API, JavaFX application code can referenceAPIs from any Java library. For example, JavaFX applications can use Java APIlibraries to access native system capabilities and connect to server-based middlewareapplications.The look and feel of JavaFX applications can be customized. Cascading Style Sheets(CSS) separate appearance and style from implementation so that developers canconcentrate on coding. Graphic designers can easily customize the appearance andstyle of the application through the CSS. If you have a web design background, or ifyou would like to separate the user interface (UI) and the back-end logic, then you candevelop the presentation aspects of the UI in the FXML scripting language and useJava code for the application logic. If you prefer to design UIs without writing code,then use JavaFX Scene Builder. As you design the UI, Scene Builder creates FXMLmarkup that can be ported to an Integrated Development Environment (IDE) so thatdevelopers can add the business logic.JavaFX Overview 1-1

AvailabilityAvailabilityThe JavaFX APIs are available as a fully integrated feature of the Java SE RuntimeEnvironment (JRE) and the Java Development Kit (JDK ). Because the JDK is availablefor all major desktop platforms (Windows, Mac OS X, and Linux), JavaFX applicationscompiled to JDK 7 and later also run on all the major desktop platforms. Support forARM platforms has also been made available with JavaFX 8. JDK for ARM includesthe base, graphics and controls components of JavaFX.The cross-platform compatibility enables a consistent runtime experience for JavaFXapplications developers and users. Oracle ensures synchronized releases and updateson all platforms and offers an extensive support program for companies that runmission-critical applications.On the JDK download page, you can get a zip file of JavaFX sample applications. Thesample applications provide many code samples and snippets that show by examplehow to write JavaFX applications. See "How Do I Run a Sample Application?" for moreinformation.Key FeaturesThe following features are included in JavaFX 8 and later releases. Items that wereintroduced in JavaFX 8 release are indicated accordingly: Java APIs. Java

This tutorial is a compilation of three documents that were previously delivered with the JavaFX 2.x documentation set: JavaFX Overview, JavaFX Architecture, and Getting Started with JavaFX.

Related Documents:

.media - in Default VM Arguments. Note that your JavaFX library location can be different depending on the location that you unzipped. METHOD III: From CMD Prompt: java --module-path "C:\Users\selim\Documents\javafx-sdk-11.0.2\lib" --add-m

This chapter describes how to add JavaFX co ntent into a Swing application and how to use threads correctly when both Swing and JavaFX content operate within a single application. JavaFX SDK provides the JFXPanel class, which is located in the javafx.embed.swing package and enables you to embed

Oct 10, 2011 · Support for ARM platforms has also been made available with JavaFX 8. JDK for ARM includes the base, graphics and controls components of JavaFX. To install JavaFX install your chosen version of the Java Runtime environment and Java Development kit. Features offered by JavaFX include

Database Operations in JavaFX . At first, part of JavaFX tutorial series, we created a sample JavaFX project, designed the draft version of the UI and set up an Oracle XE database. In this post, we will create controller, model, DAO, and Util classes to do DB operations. Before starting to code, I want to give more information about our example .

What You Will Learn 1 1.1 Background Basics 2 JavaFX Integration 2 1.2 The NetBeans Platform: The Big Picture 3 Module System API 3 . 2.4 Improving the User Experience 63 2.5 Concurrency and Thread Safety 68 . 3.2 Building JavaFX Programs 87 Creating a JavaFX Application 88 Java APIs 88

Swing includes a . JFXPanel. class to embed JavaFX components into a Swing application, and JavaFX includes a . SwingNode. class to embed Swing components into a JavaFX application. Both classes provide corresponding API documentation. Additionally, the official Java documentation site includes an arti

General rules 8 Tecniche di programmazione A.A. 2020/2021 A JavaFX application extends javafx.application.Application The main() method should call Application.launch() The start() method is the main entry point for all JavaFX applications Called with a Stage connected to the Operating System's window The content of the scene is represented as a hierarchical

The American Board of Radiology . ATTN: Valerie P. Jackson, M.D. Executive Director . 5441 E. Williams Circle . Tucson, Arizona 85711-7412 . SUBJECT: AMERICAN BOARD OF RADIOLOGY, REQUEST FOR ADDITIONAL INFORMATION REGARDING RECOGNITION OF NEW BOARD CERTIFICATES AND MODIFICATION OF THE CURRENT . RECOGNITION OF CERTIFICATION IN DIAGNOSTIC RADIOLOGY . Dear Dr. Jackson, I am writing in response to .