2-4. Manipulating Layout via Grids

Problem

You want to create a nice-looking form type user interface using grid type layout.

Solution

Create a simple form designer application to manipulate the user interface dynamically using the JavaFX’s javafx.scene.layout.GridPane. The form designer application will have the following features:

  • It will toggle the display of the Grid layout’s grid lines for debugging.
  • It will adjust the top padding of the GridPane.
  • It will adjust the left padding of the GridPane.
  • It will adjust the horizontal gap between cells in the GridPane.
  • It will adjust the vertical gap between cells in the GridPane.
  • It will align controls within cells horizontally.
  • It will align controls within cells vertically.

The following code ...

Get JavaFX 2.0: Introduction by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.