- Let's create GridPane, which will hold the components in a grid of rows and columns:
GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(25, 25, 25, 25));
- First, we will create a button and add two classes, btn and btn-primary, to it. In the next step, we will define these selectors with the required CSS properties:
Button primaryBtn = new Button("Primary");
gridPane.add(primaryBtn, 0, 1);
- Now, let's provide the required CSS properties for the classes, btn and btn-primary. The selector for the classes are of the form .<class-name>:
Get Java 9 Cookbook now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.