JavaFX provides a convenient approach to component sizes with properties: min, preferred, and max. These values are used by layout managers to represent their children.
Let's take a button, for example. A button's width is governed by the length of the text inside; on the other hand, a button can't outgrow its container so text may be shortened if there is not enough space—these are natural constraints, but you can impose extra ones by setting setMinWidth() and setMaxWidth().
Let's see in code how different size constraints work in JavaFX:
// chapter7/resising/MinMaxSizeDemo.java
Button btnNoMin = new Button("I have no min width");
Button btnMin = new Button("I have min width");
btnMin.setMinWidth(100);
Button btnMax = new Button("I have limited max width");
btnMax.setMaxWidth(140);
Button btnBig...