Я создаю пример приложения, которое демонстрирует поведение, которого вы пытаетесь достичь. В этом приложении я установил Min Width
для левой TitlePane's
AnchorPane
на 300
.
Главная
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author blj0011
*/
public class JavaFXApplication259 extends Application
{
@Override
public void start(Stage stage) throws Exception
{
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
launch(args);
}
}
Контроллер
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.XYChart;
/**
*
* @author blj0011
*/
public class FXMLDocumentController implements Initializable
{
@FXML
LineChart chart1, chart2;
@Override
public void initialize(URL url, ResourceBundle rb)
{
// TODO
XYChart.Series<Number, Number> series1 = new XYChart.Series<>();
series1.setName("Series 1");
series1.getData().add(new XYChart.Data<>(1000, 20));
series1.getData().add(new XYChart.Data<>(2000, 100));
series1.getData().add(new XYChart.Data<>(3000, 80));
series1.getData().add(new XYChart.Data<>(4000, 180));
series1.getData().add(new XYChart.Data<>(5000, 10000));
series1.getData().add(new XYChart.Data<>(6000, -10));
chart1.getData().add(series1);
}
}
FXML
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.chart.LineChart?>
<?import javafx.scene.chart.NumberAxis?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane id="AnchorPane" prefHeight="581.0" prefWidth="908.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxapplication259.FXMLDocumentController">
<children>
<SplitPane dividerPositions="0.29797979797979796" layoutX="6.0" layoutY="7.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<TitledPane animated="false" layoutX="-11.0" layoutY="74.0" text="untitled" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane minHeight="0.0" minWidth="300.0">
<children>
<LineChart fx:id="chart1" layoutX="-117.0" layoutY="-43.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="-0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
</children>
</AnchorPane>
</content>
</TitledPane>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<TitledPane animated="false" layoutX="127.0" layoutY="170.0" minWidth="300.0" text="untitled" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<LineChart fx:id="chart2" layoutX="91.0" layoutY="65.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<xAxis>
<NumberAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
</children>
</AnchorPane>
</content>
</TitledPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>