You are previewing JavaFX™: A Beginner’s Guide.
O'Reilly logo
JavaFX™: A Beginner’s Guide

Book Description

Essential Skills--Made Easy

Create immersive, interactive environments for any platform. JavaFX: A Beginner's Guide starts by explaining the technology behind JavaFX and quickly moves on to installing the JavaFX development environment and tools, including the JavaFX SDK, the Java SE JDK, and NetBeans. Then, you'll learn how to develop desktop, browser, and mobile applications with ease. The book covers effects and transformations, animation, events, and Swing components. Techniques for creating custom modes, embedding video and music, using JavaFX layouts, and styling with CSS are also discussed. Get started using JavaFX right away with help from this fast-paced tutorial.

Designed for Easy Learning:

• Key Skills & Concepts--Chapter-opening lists of specific skills covered in the chapter

• Ask the Expert--Q&A sections filled with bonus information and helpful tips

• Try This--Hands-on exercises that show you how to apply your skills

• Notes--Extra information related to the topic being covered

• Tips--Helpful reminders or alternate ways of doing things

• Annotated Syntax--Example code with commentary that describes the programming techniques being illustrated

Table of Contents

  1. Cover Page
  2. JavaFX™: A Beginner’s Guide
  3. Copyright Page
  4. Dedication
  5. Contents
  6. Acknowledgments
  7. Introduction
  8. 1 Introduction to JavaFX
    1. What Is JavaFX?
    2. What Is Needed for JavaFX Development?
      1. Required Skills and Knowledge
      2. Required Software
    3. Downloading and Installing the Required Software
      1. NetBeans
    4. Try This: Configure Your NetBeans
    5. Chapter 1 Self Test
  9. 2 Setting the Scene
    1. Creating a New JavaFX Project
      1. The Empty JavaFX Project
      2. Adding Working Files to Your Project
      3. Exploring the Empty Project in NetBeans
    2. Working with the Script File
      1. The Comments
      2. The package Statement
    3. Your First Stage
      1. Inserting the Stage Snippet
    4. A JavaFX Script Primer
      1. Name-Value Pairs
    5. Compiling Your JavaFX Script
    6. Chapter 2 Self Test
  10. 3 Hello World
    1. Writing to the Screen
      1. Adding Some Descriptive Comments
      2. Adding the Stage and Scene
      3. Adding Some Text
    2. Try This: Create a TV Run Configuration
      1. Adding a Function
      2. Using bind with a Text Node
    3. Chapter 3 Self Test
  11. 4 Creating Shapes
    1. Drawing Shapes
      1. Before You Begin
      2. Lines and Polylines
      3. Rectangles
      4. Polygons
      5. Arcs
      6. Circles and Ellipses
    2. Try This: Create Multiple Shapes
    3. Chapter 4 Self Test
  12. 5 Using Colors and Gradients
    1. Using Color
      1. Predefined Colors
      2. Mixing Colors
    2. Using Gradients
      1. LinearGradients
      2. RadialGradients
    3. Try This: Create a Custom Gradient
    4. Chapter 5 Self Test
  13. 6 Using Images
    1. The ImageView Node
    2. The Image Class
    3. JavaFX Production Suite
    4. Using an FXZ File in JavaFX
    5. Try This: Working with Different Image Types
    6. Chapter 6 Self Test
  14. 7 Applying Effects and Transformations
    1. Effects
      1. Bloom
      2. ColorAdjust
      3. GaussianBlur
      4. Glow
      5. DropShadow
      6. InvertMask
      7. Lighting
      8. SepiaTone
    2. Transformations
      1. XY Transformations
      2. Rotation
      3. PerspectiveTransform
    3. Try This: Combining Multiple Effects
    4. Chapter 7 Self Test
  15. 8 Basic Animation
    1. Timelines
    2. Animating Along a Path
    3. Try This: Create a Path Animation
    4. Chapter 8 Self Test
  16. 9 Using Events
    1. What Are Events?
      1. Mouse Events
      2. Key Events
    2. Chapter 9 Self Test
  17. 10 Give It Some Swing
    1. What Is Swing?
    2. Swing Components
      1. SwingButton
      2. SwingCheckBox
      3. SwingComboBox and SwingComboBoxItem
    3. Try This: Create an Application with Swing
    4. Chapter 10 Self Test
  18. 11 Custom Nodes and Overriding
    1. Overriding a Node
    2. Creating a RoundButton
    3. Creating a Custom Node
    4. Try This: Create Your Own Shapes
    5. Chapter 11 Self Test
  19. 12 Embedded Video and Music
    1. Playing Video
      1. Creating a Play/Pause Button
      2. Creating a Progress Indicator
    2. Playing Audio
    3. Chapter 12 Self Test
  20. 13 Using JavaFX Layouts
    1. The HBox
    2. The VBox
    3. Nested Layouts
    4. Try This: Using Other Layouts
    5. Chapter 13 Self Test
  21. 14 Style Your JavaFX with CSS
    1. Adding a Style Sheet to Your Packages
      1. Creating a Style
      2. Using Your Styles
    2. Creating Independent Style Classes
    3. Try This: Experimenting with Styles
    4. Chapter 14 Self Test
  22. A Deploying JavaFX
    1. Deploying JavaFX
  23. B Node Property Reference
    1. Node Properties
    2. Mouse Events
    3. Key Codes
    4. MediaPlayer Properties
  24. C JavaFX Command-Line Arguments
    1. Command-Line Environment
    2. javafxc
    3. javafx
  25. D Answers to Self Tests
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Chapter 11
    12. Chapter 12
    13. Chapter 13
    14. Chapter 14
  26. Index