You are previewing Quick Start Guide to JavaFX.
O'Reilly logo
Quick Start Guide to JavaFX

Book Description

Get started with JavaFX

Develop and deploy interactive client applications in no time with help from this practical tutorial from Oracle Press. With a focus on working in NetBeans IDE, Quick Start Guide to JavaFX explains how to use JavaFX layouts, draw shapes, use coloring and gradient tools, load images, apply effects and transformations, include animation, and embed media. You'll also get details on using JavaFX events, subclassing existing nodes, creating custom nodes, working with WebView, and styling your applications with CSS. Designed for easy learning, the book features:

  • 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
  • Cautions -- Errors and pitfalls to avoid
  • Annotated Syntax -- Example code with commentary that describes the programming techniques being illustrated
  • Self-tests -- Chapter-ending quizzes to reinforce your skills

Table of Contents

  1. CoverĀ 
  2. About the Author
    1. About the Technical Editor
  3. Title Page
  4. Copyright Page
  5. Contents at a Glance
  6. ContentsĀ 
  7. Introduction
    1. Why This Book?
  8. Chapter 1: Introduction to JavaFX
    1. What Is JavaFX?
    2. What Is Needed for JavaFX Development?
      1. Required Skills and Knowledge
      2. Required Software
      3. Required Hardware
    3. Downloading and Installing the Required Software
      1. NetBeans
    4. Try This: Configure Your NetBeans
    5. Chapter 1 Self Test
  9. Chapter 2: Setting the Scene
    1. Creating a New JavaFX Project
      1. The (Not-so) Empty JavaFX Project
      2. Examining the Project Files
      3. Exploring the Project in NetBeans
    2. Working with the JavaFXForBeginners.java File
      1. The Comments
      2. The package Statement
    3. Your First Stage
      1. The Application Entry Point
    4. The Sample.fxml File
    5. Compiling Your JavaFX Application
    6. Chapter 2 Self Test
  10. Chapter 3: Hello World
    1. What Is MVC?
    2. Using JavaFX Scene Builder
      1. Working with Containers
      2. Working with Controls
    3. Creating Your Own Hello World Application
      1. Using JavaFX Binding
    4. An Introduction to Methods and Properties
      1. Java Methods
      2. JavaFX Properties
        1. Building Your Property and Method(s)
        2. Binding to the helloMessage Property
    5. Chapter 3 Self Test
  11. Chapter 4: Using JavaFX Layouts
    1. The HBox
    2. The VBox
    3. Nested Layouts
    4. Try This: Using Other Layouts
    5. Chapter 4 Self Test
  12. Chapter 5: Creating Shapes
    1. JavaFX Scene Graph
    2. Drawing Shapes
      1. Before You Begin
      2. Lines
      3. Rectangles
      4. Polygons
      5. Arcs
      6. Circles and Ellipses
    3. Try This: Create Multiple Shapes
    4. Chapter 5 Self Test
  13. Chapter 6: Using Colors and Gradients
    1. Using Color
      1. Predefined Colors
      2. Mixing Colors
        1. Color.rgb
        2. Color.hsb
        3. Color.web
        4. The alpha Attribute
    2. Using Gradients
      1. LinearGradients
      2. RadialGradients
    3. Try This: Create a Custom Gradient
    4. Chapter 6 Self Test
  14. Chapter 7: Using Images
    1. The ImageView Node
    2. The Image Class
    3. Try This: Working with Different Image Types
    4. The Canvas
    5. Chapter 7 Self Test
  15. Chapter 8: Applying Effects and Transformations
    1. Effects
      1. Bloom
      2. ColorAdjust
      3. GaussianBlur
      4. Glow
      5. DropShadow
      6. Lighting
        1. Distant
        2. PointLight
        3. Spot
      7. SepiaTone
    2. Transformations
      1. XY Transformations
      2. Rotation
      3. PerspectiveTransform
    3. Try This: Combining Multiple Effects
    4. Chapter 8 Self Test
  16. Chapter 9: Basic Animation
    1. Timelines
    2. Animating Along a Path
    3. Try This: Create a Path Animation
    4. Chapter 9 Self Test
  17. Chapter 10: Using Events
    1. What Are Events?
      1. Mouse Events
      2. Key Events
    2. Chapter 10 Self Test
  18. Chapter 11: Custom Nodes and Subclassing
    1. Subclassing Node
    2. Creating a RoundButton
    3. Try This: Create Your Own Shapes
    4. Chapter 11 Self Test
  19. Chapter 12: Working with WebView
    1. Rendering HTML
      1. Communicating Between JavaScript and JavaFX
    2. Chapter 12 Self Test
  20. Chapter 13: 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 13 Self Test
  21. Chapter 14: Embedded Media
    1. Playing Video
      1. Creating a Play/Pause Button
      2. Creating a Progress Indicator
    2. Chapter 14 Self Test
  22. Appendix A: Packaging and Deploying JavaFX
    1. JavaFX Packager Tool
    2. Self-Contained Application Packages
    3. Web Start
  23. Appendix B: The Swing of Things
    1. JavaFX Swing Compatibility
    2. Putting JavaFX in Swing Apps
  24. Appendix C: 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
  25. Index