I have 4 fxml files... MainScreen, Screen1, Screen2, Screen3. MainScreen has splitPane left side there is a listView... on the right side by default shows screen1. I want to make it in such a way that when Screen2 button is pressed, Screen1 is replaced by screen2, when Screen3 button is pressed it replaces what ever screen that was loaded at that time. Only the Contents of right side of the splitPane can change and everything else satys the same.
Is this possible and if so how can i be able to achieve it?
MainScreen.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml">
<children>
<SplitPane dividerPositions="0.26755852842809363" focusTraversable="true" prefHeight="332.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="68.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<ListView prefHeight="398.0" prefWidth="157.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
</items>
</SplitPane>
<HBox id="HBox" alignment="CENTER" layoutX="310.0" layoutY="30.0" prefHeight="23.0" prefWidth="237.0" spacing="5.0">
<children>
<Button mnemonicParsing="false" text="screen1" />
<Button mnemonicParsing="false" text="screen2" />
<Button mnemonicParsing="false" text="screen3" />
</children>
</HBox>
</children>
</AnchorPane>
Screen1.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="330.0" prefWidth="435.0" xmlns:fx="http://javafx.com/fxml">
<children>
<Label layoutX="157.0" layoutY="128.0" prefHeight="44.0" prefWidth="99.0" text="Screen 1 Loaded" />
</children>
</AnchorPane>
Screen2.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="330.0" prefWidth="435.0" xmlns:fx="http://javafx.com/fxml">
<children>
<Label layoutX="145.0" layoutY="121.0" prefHeight="44.0" prefWidth="99.0" text="Screen 2 Loaded" />
</children>
</AnchorPane>
Screen3.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="330.0" prefWidth="435.0" xmlns:fx="http://javafx.com/fxml">
<children>
<Label layoutX="145.0" layoutY="121.0" prefHeight="44.0" prefWidth="99.0" text="Screen 3 Loaded" />
</children>
</AnchorPane>