Planning node size behavior with grow priorities

For simpler layout managers, such as HBox, you can also control how nodes behave under pressure.

For example, let's look at the browser address bar again: there are some buttons on the left, a text field for the address, and some buttons on the right—but we want only the address box to change size:

API methods for that are static and called setHgrow() for HBox and setVgrow() for VBox. GridPane has both of them too. For some reason, they are static and their usage looks as follows: 

// chapter7/resizing/HGrowDemo.javaHBox root = new HBox(10);TextField address = new TextField("http://stackoverflow.com"); ...

Get Mastering JavaFX 10 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.