TitledBorderPane
is a BorderPane
with a border and a title label placed on the border at
a certain position. The default position is just like in the screenshot below CENTER_LEFT
. The pane
including border and title is completely styleable by CSS. Usually each theme defines an additional style to display
a single border line at the top edge of the pane only - the related style class name is top-border-only
.
The screenshot was taken from TitledBorderPaneDemo which can be downloaded from the link below.
Pane content = new StackPane();
content.setPrefSize(400, 300);
StackPane childPane = new StackPane(new Label("TitleBorderPane Content"));
TitledBorderPane p = new TitledBorderPane("Border Title", childPane);
//title position is relative to top border line
p.setTitlePosition(Pos.CENTER);
//show top border only
//p.getStyleClass().add("top-border-only");
content.getChildren().add(p);