GroupBox - that is usual Group layout, as far as I see.
TitledBorder - looks like a TitledPane (which is usually a component of Accordion, but could be a separately existing control).
JavaFX-2 analogs looks different from yours (but not significantly), and as usual, you can use different ways of control appearance changing: css, control's skin replacing, etc
If you need to make the label text / border size larger you should only have to edit the CSS and the topAnchor of the child AnchorPane and the first argument of -fx-border-insets of the parent AnchorPane.
.bordered-titled-title {
-fx-background-color: white;
-fx-translate-y: -10; /* play around with this value when changing the title font to get a vertically centered title */
}
.bordered-titled-border {
-fx-content-display: top;
-fx-border-insets: 20 15 15 15;
-fx-background-color: white;
-fx-border-color: black;
-fx-border-width: 2;
}
.bordered-titled-content {
-fx-padding: 26 10 10 10;
}
Using this CSS it now looks like this:
Update:
Problems when title is longer then content:
GroupBox - that is usual Group layout, as far as I see.
TitledBorder - looks like a TitledPane (which is usually a component of Accordion, but could be a separately existing control).
JavaFX-2 analogs looks different from yours (but not significantly), and as usual, you can use different ways of control appearance changing: css, control's skin replacing, etc
I used
TitledPane
withsetCollapsible(false)
. It looks more consistent than using CSS styles. Here is resultHere is an FXML document that can be loaded into SceneBuilder which has similar functionality:
If you need to make the label text / border size larger you should only have to edit the CSS and the topAnchor of the child AnchorPane and the first argument of -fx-border-insets of the parent AnchorPane.
FXML version of jewelsea's answer:
TitledBorder (I renamed the BorderedTitledPane to TitledBorder)
FXML usage:
Do no forget the Stylesheet!
Use this CSS for a normal font:
Using this CSS it now looks like this:
Update: Problems when title is longer then content:
Any hint to fix this problem?
No such standard control, but it it is easy to create your own. Here is a sample implementation:
And the accompanying css for it:
The code is from a example I created in response to an Oracle JavaFX forum thread post "Equivalent to BorderFactory.createTitledBorder".
The output of the example program is as shown below.
Here is a GroupBox implementation based on TitledPane. It provides three methods to set the title, content, and content padding of the GroupBox.