As of this writing, JavaFX's current version of 1.2 makes available more than a dozen JavaFX
components (with the promise of more to come in future releases) located in the package
javafx.scene.control . These are native JavaFX components designed from scratch to
provide the level of rich properties and behaviors expected from a rich client platform. They
include button, check-box, toggle buttons such as the radio button, hyperlink button, text box,
label, and so on. See the recipe Creating a form with JavaFX controls for details.
This chapter also explores ways to integrate JavaFX and the venerable Java Swing GUI
framework. Over the years, Swing has evolved into a stable and reliable GUI platform with
a well-understood component model. Developers have been writing Swing components for
well over a decade, producing a wealth of GUI components and knowledge. That fact did not
escape the JavaFX engineers, so they have provided a bridge API, found in javafx.ext.
swing , to let developers expose standard Swing controls inside JavaFX applications. If your
needs go beyond the standard controls, you will learn how to wrap your custom Swing controls
as JavaFX controls.
Finally, this chapter explores ways to customize the look and feel of your components using
the JavaFX's implementation of Cascading Style Sheets (CSS) for skinning components. All
visual nodes in a JavaFX scene can be injected with CSS styles similarly to web pages. You will
learn how to style your JavaFX applications using inline or externalized CSS files.
I know you can't wait, so let's get started!
Creating a form with JavaFX controls
The previous chapters demonstrated the power of the JavaFX platform in creating engaging UI
experiences with features such as animation, effects, and so on. Data capture is an equally
important aspect for a great user experience. In this recipe, you will learn how to assemble
standard JavaFX GUI controls to build a form to collect data.
This recipe attempts to use as many standard JavaFX controls as possible to create a form
to collect data from the user. All of the controls used here are found in the package javafx.
What is a Control anyway, you may ask? Controls provide a uniform graphical and interaction
model with consistent and predictable behaviors. For instance, a button, a text input field,
and a label, are all examples of standard controls available in JavaFX. All controls implement
the Control class as the basis for all user interface controls that are part of the JavaFX