JavaFX 2

Introducing JavaFX Reversi (Building Dynamic UI Layouts in JavaFX)

When I am working on a problem, I never think about beauty. I think only of how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong. —Buckminster Fuller JavaFX has facilities for creating dynamic layouts that allow you to easily create beautiful-looking user interfaces […]

Dynamic Layout Techniques (Building Dynamic UI Layouts in JavaFX) Part 1

JavaFX provides a wide variety of layouts that are suitable for different tasks. They range from the versatile bind to the freeform Pane and Region, which allow you to create an entirely new layout on the fly. There is also a large set of built-in layouts, including HBox, VBox, AnchorPane, BorderPane, StackPane, TilePane, FlowPane, and […]

Dynamic Layout Techniques (Building Dynamic UI Layouts in JavaFX) Part 2

Using FlowPane and Boxes for Directional Alignment In the previous sections we showed how you can use StackPane and TilePane to create dynamic nested user interfaces, but what if you simply want to arrange nodes along a vertical or horizontal line? This is where the directional layouts, HBox, VBox, and FlowPane, come in. They allow […]

Creating Custom Regions (Building Dynamic UI Layouts in JavaFX)

In previous sections we have made use of the Region class to provide simple styled backgrounds for our application, but the Region class underlies all of the JavaFX layouts and is capable of much more than just this. In this section we show you how to create custom Regions in JavaFX that are fully resizable […]

Laying Out the Tiles Using a GridPane (Building Dynamic UI Layouts in JavaFX)

One of the most flexible and powerful layouts contained in JavaFX is the GridPane. It lets you arrange the children in a grid composed of rows and columns, optionally assigning constraints such as alignment, grow, and margin to individual nodes or an entire row/column. You can also do advanced layouts that will span rows and/or […]

Aligning and Stretching with AnchorPane (Building Dynamic UI Layouts in JavaFX)

The last built-in layout is the AnchorPane. It is a fairly specialized layout that serves two related purposes. When used with one or two nonopposing constraints, it can be used to align the child to a particular corner of the layout with a set stand-off. The other purpose is to stretch the child horizontally and/or […]

When to Use Different Layouts (Building Dynamic UI Layouts in JavaFX)

The combination of different layout techniques discussed throughout this topic creates a very powerful capability for creating dynamic layouts. However, inasmuch as there are so many ways to accomplish the same results, it can often be confusing as to what the best practice is when creating new layouts. In this section, we discuss the benefits […]

A New Perspective on Reversi: The JavaFX 3D Scene Graph (Building Dynamic UI Layouts in JavaFX)

The Reversi application is starting to shape up, but is in need of a little perspective to make it more visually appealing. JavaFX comes with 3D capabilities that let you do transformations on your scene graph objects to create more advanced visual effects. We take advantage of these 3D capabilities to make the Reversi application […]

Bringing Reversi to Life (Building Dynamic UI Layouts in JavaFX)

Up to this point we have been singularly focused on layouts, which is important but doesn’t make for a very interesting game. However, the beauty of using dynamic layouts is that with a few enhancements to the game algorithm, we can turn this static application into a dynamic playable game. Highlighting Legal Moves The first […]

Trying Out the JavaFX UI Controls (Using the JavaFX UI Controls)

Miracles are a retelling in small letters of the very same story which is written across the whole world in letters too large for some of us to see. —C. S. Lewis JavaFX has a rich set of UI controls for creating your applications. These range from relatively simple controls such as TextField to more […]