A TitledPane is a panel with a title that can be opened and closed.
The panel in a TitledPane can be any
Node such as UI controls or groups
of nodes added to a layout container.
It is not recommended to set the MinHeight, PrefHeight, or MaxHeight for this control. Unexpected behavior will occur because the TitledPane's height changes when it is opened or closed.
Note that whilst TitledPane extends from Labeled, the inherited properties
are used to manipulate the TitledPane header, not the content area itself. If
the intent is to modify the content area, consider using a layout container
javafx.scene.layout.StackPane and setting your actual content
inside of that. You can then manipulate the StackPane to get the layout
results you are after.
TitledPane t1 = new TitledPane("T1", new Button("B1"));