Peter Penzov
Peter Penzov

Reputation: 1588

Default label in FlowPane

I have a FlowPane with many BorderPanes as windows. I would like to display something like water mark or label <empty> when the FlowPane is empty.

Is there any solution?

Upvotes: 0

Views: 348

Answers (1)

James_D
James_D

Reputation: 209339

Have you tried something like this:

FlowPane flowPane = ... ;

StackPane container = new StackPane();
Label placeHolder = new Label("No content in flow pane");
placeHolder.visibleProperty().bind(Bindings.isEmpty(flowPane.getChildren()));
container.getChildren().addAll(flowPane, placeHolder);

Then, obviously, just add the container into your UI where you previously added the flow pane.

Upvotes: 3

Related Questions