Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How can i hide an item in HBox, and made space used by this item available to other items.

TitledPane legendPane = new TitledPane("Legend", _legend);
legendPane.setVisible(false);
LineChart chart = new LineChart<Number, Number>(_xAxis, _yAxis);

HBox hbox = new HBox(5);
hbox.getChildren().addAll(legendPane, chart);

In the above code i want the chart node to use all available space when the legend pane is hidden.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
312 views
Welcome To Ask or Share your Answers For Others

1 Answer

Before calling legendPane.setVisible, call:

legendPane.managedProperty().bind(legendPane.visibleProperty());

The Node.managed property prevents a node in a Scene from affecting the layout of other scene nodes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...