Title | Pro JavaFX 9: A Definitive Guide to Building Desktop, Mobile, and Embedded Java Clients |
---|
File Size | 6.0 MB |
---|
Total Pages | 354 |
---|
Table of Contents
Contents
About the Authors
About the Technical Reviewers
Acknowledgments
Chapter 1: Getting a Jump-Start in JavaFX
A Brief History of JavaFX
Prepare Your JavaFX Journey
Required Tools
JavaFX, the Community
Use the Official Specifications
Scenic View
Packaging and Distribution
Developing Your First JavaFX Program: Hello Earthrise
Compiling and Running from the Command Line
Understanding the Hello Earthrise Program
What Happened to the Builders?
The JavaFX Application
A Stage and a Scene
Displaying Images
Displaying Text
Working with Graphical Nodes as a Group
Clipping Graphical Areas
Animating the Text to Make It Scroll Up
Building and Running the Program with NetBeans
Developing Your Second JavaFX Program: “More Cowbell!”
Building and Running the Audio Configuration Program
The Behavior of the Audio Configuration Program
Understanding the Audio Configuration Program
The Magic of Binding
Colors and Gradients
The Model Class for the Audio Configuration Example
Using InvalidationListeners and Lambda Expressions
Surveying JavaFX Features
Summary
Resources
Chapter 2: Creating a User Interface in JavaFX
Programmatic vs. Declarative Creation of the User Interface
Introduction to Node-Centric UIs
Setting the Stage
Understanding the Stage Class
Using the Stage Class: The StageCoach Example
Understanding the StageCoach Program
Obtaining Program Arguments
Setting the Style of the Stage
Controlling Whether a Stage Is Resizable
Making a Stage Full Screen
Working with the Bounds of the Stage
Drawing Rounded Rectangles
Dragging the Stage on the Desktop When a Title Bar Isn’t Available
Using UI Layout Containers
Ascertaining Whether the Stage Is in Focus
Controlling the Z-Order of the Stage
Closing the Stage and Detecting When It Is Closed
Making a Scene
Using the Scene Class: The OnTheScene Example
Understanding the OnTheScene Program
Setting the Cursor for the Scene
Painting the Scene’s Background
Populating the Scene with Nodes
Finding a Scene Node by ID
Accessing the Stage from the Scene
Inserting a Node into the Scene’s Content Sequence
CSS Styling the Nodes in a Scene
Handling Input Events
Surveying Mouse, Keyboard, Touch, and Gesture Events and Handlers
Understanding the KeyEvent Class
Understanding the MouseEvent Class
Understanding the TouchEvent Class
Understanding the GestureEvent Class
Animating Nodes in the Scene
Using a Timeline for Animation
The Metronome1 Example
Understanding the Metronome1 Program
Understanding the Timeline Class
Inserting Key Frames into the Timeline
Controlling and Monitoring the Timeline
Using the Transition Classes for Animation
The MetronomeTransition Example
The Behavior of the MetronomeTransition Program
Understanding the MetronomeTransition Program
Using the TranslateTransition Class
Controlling and Monitoring the Transition
The MetronomePathTransition Example
The Behavior of the MetronomePathTransition Program
Understanding the MetronomePathTransition Program
Using the PathTransition Class
Drawing an Ellipse
The Zen of Node Collision Detection
Understanding the ZenPong Program
Using the KeyFrame Action Event Handler
Using the Node intersects() Method to Detect Collisions
Dragging a Node
Giving Keyboard Input Focus to a Node
Using the onKeyPressed Event Handler
Summary
Resources
Chapter 3: Properties and Bindings
Forerunners of JavaFX Binding
A Motivating Example
Understanding Key Interfaces and Concepts
Understanding the Observable Interface
Understanding the ObservableValue Interface
Understanding the WritableValue Interface
Understanding the ReadOnlyProperty Interface
Understanding the Property Interface
Understanding the Binding Interface
Type-Specific Specializations of Key Interfaces
A Common Theme for Type-Specific Interfaces
Commonly Used Classes
Creating Bindings
Understanding the Bindings Utility Class
Understanding the Fluent Interface API
Understanding the JavaFX Beans Convention
The JavaFX Beans Specification
Understanding the Eagerly Instantiated Properties Strategy
Understanding the Lazily Instantiated Properties Strategy
Using Selection Bindings
Adapting JavaBeans Properties to JavaFX Properties
Understanding JavaBeans Properties
Understanding the JavaFX Property Adapters
Summary
Resources
Chapter 4: Using Scene Builder to Create a User Interface
Setting the Stage with FXML
Creating a User Interface Graphically with JavaFX Scene Builder
Understanding the FXML File
Understanding the Controller
Understanding the FXMLLoader
Understanding the FXML Loading Facility
Understanding the FXMLLoader Class
Understanding the @FXML Annotation
Exploring the Capabilities of FXML Files
The Deserialization Power of the FXML Format
Understanding Default and Static Properties
Understanding Attribute Resolutions and Bindings
Using Multiple FXML Files
Creating Custom Components Using fx:root
Event Handling Using Scripting or Controller Properties
Using JavaFX Scene Builder
Overview of JavaFX Scene Builder
Understanding the Menu Bar and Items
Understanding the Library Panel
Understanding the Document Panel
Understanding the Content Panel
Understanding the Inspector Panel
Summary
Resources
Chapter 5: Collections and Concurrency
Understanding Observable Collections and Arrays
Understanding ObservableList
Handling Change Events in ListChangeListener
Understanding ObservableMap
Understanding ObservableSet
Understanding ObservableArrays
Using Factory and Utility Methods from FXCollections
Using the JavaFX Concurrency Framework
Identifying the Threads in a JavaFX Application
Fixing Unresponsive UIs
Understanding the javafx.concurrent Framework
Understanding the Worker Interface
Understanding the Task<V> Abstract Class
Understanding the Service<V> Abstract Class
Understanding the ScheduledService<V> Abstract Class
Mixing JavaFX with Other GUI Toolkits
Embedding JavaFX Scenes in Swing Applications
Embedding JavaFX Scenes in SWT Applications
Embedding Swing Components in JavaFX Applications
Summary
Resources
Chapter 6: Creating Charts in JavaFX
Structure of the JavaFX Chart API
Using the JavaFX PieChart
The Simple Example
Some Modifications
Using the XYChart
Using the ScatterChart
A Simple Implementation
Improving the Simple Implementation
Using the LineChart
Using the BarChart
Using the StackedBarChart
Using the AreaChart
Using the StackedAreaChart
Using the BubbleChart
Summary
Resources
Chapter 7: Connecting to Enterprise Services
Front-End and Back-End Platforms
Merging JavaFX and Java Enterprise Modules in the Same Environment
Using JavaFX to Call Remote (Web) Services
REST
Setting up the Application
Using the Stack Exchange API
JSON Response Format
XML Response Format
Asynchronous Processing
Converting Web Services Data to TableView
Using External Libraries
Gluon Connect
JAX-RS
Summary
Index