I have a view with two TitledPane
s in a SplitPane
oriented vertically. I want when I collapse one of them, the other one to be resized to the Scene
's height. Here is the code of my .fxml
file:
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TableColumn?>
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:id="pane"
fx:controller="stackoverflow.three.Controller">
<center>
<SplitPane fx:id="split" orientation="VERTICAL">
<TitledPane fx:id="first" text="First">
<TableView>
<columns>
<TableColumn text="Test"/>
</columns>
</TableView>
</TitledPane>
<TitledPane fx:id="second" text="Second">
<TableView>
<columns>
<TableColumn text="Test"/>
</columns>
</TableView>
</TitledPane>
</SplitPane>
</center>
</BorderPane>
Here are some sreenshots: The initial state: When the first is collapsed:
As you can see there is a gap at the bottom of the view, if I collapse the first one, but I don't want that gap.
I've tried to se the maxHeight
for example to Infinity, but then the auto move up to the firs one is not working...
Any ide what can I do?
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TableColumn?>
<BorderPane fx:id="pane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="stackoverflow.three.Controller">
<center>
<VBox prefHeight="800.0">
<children>
<TitledPane fx:id="first" text="First">
<content>
<TableView prefHeight="2000.0">
<columns>
<TableColumn text="Test" />
</columns>
</TableView>
</content>
</TitledPane>
<TitledPane fx:id="second" text="Second">
<content>
<TableView prefHeight="2000.0">
<columns>
<TableColumn text="Test" />
</columns>
</TableView>
</content>
</TitledPane>
</children>
</VBox>
</center>
</BorderPane>