How can I create a responsive box design - javafx

So I have 2 hboxes on top of each other to create the description and content of each box. They seem to look fine at the current size (look at img 1). However, it is not responsive. Once I use a bigger screen, the boxes don't adjust to the size and just stay in place (look at img 2). Sometimes they don't even stay on top of each other but move to the right or the left (look at img 3). Could you please help me suggest a better design to make my boxes responsive? Thank you in advance.
Image 1:
Image 2:
Image 3:
Here is my fxml code:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTabPane?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<AnchorPane id="AnchorPane" prefHeight="752.0" prefWidth="1280.0" styleClass="main-anchor-pane" stylesheets="#../../resources/css/Consolidated.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.controllers.SalesDataController">
<children>
<JFXTabPane fx:id="tabPane" layoutX="181.0" layoutY="91.0" prefHeight="752.0" prefWidth="1280.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<tabs>
<Tab fx:id="addNewTab" text="Add New">
<content>
<AnchorPane maxWidth="1.7976931348623157E308" prefWidth="1280.0">
<children>
<HBox layoutY="79.0" prefHeight="383.0" prefWidth="1228.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children>
<VBox prefHeight="331.0" prefWidth="331.0" styleClass="vbox-properties">
<children>
<GridPane prefHeight="153.0" prefWidth="331.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
</rowConstraints>
<opaqueInsets>
<Insets />
</opaqueInsets>
<padding>
<Insets left="10.0" right="10.0" />
</padding>
</GridPane>
</children>
<HBox.margin>
<Insets left="15.0" />
</HBox.margin>
</VBox>
<VBox prefHeight="312.0" prefWidth="331.0" styleClass="vbox-properties">
<children>
<GridPane prefHeight="179.0" prefWidth="183.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="12.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="12.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="12.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="12.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<opaqueInsets>
<Insets />
</opaqueInsets>
<padding>
<Insets left="10.0" right="10.0" />
</padding>
</GridPane>
<GridPane prefHeight="101.0" prefWidth="351.0">
<columnConstraints>
<ColumnConstraints />
</columnConstraints>
<rowConstraints>
<RowConstraints />
</rowConstraints>
<opaqueInsets>
<Insets />
</opaqueInsets>
<VBox.margin>
<Insets top="30.0" />
</VBox.margin>
</GridPane>
</children>
<HBox.margin>
<Insets left="71.75" right="71.75" />
</HBox.margin>
</VBox>
<VBox prefHeight="166.0" prefWidth="331.0" styleClass="vbox-properties">
<children>
<GridPane prefHeight="101.0" prefWidth="331.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
</rowConstraints>
<opaqueInsets>
<Insets />
</opaqueInsets>
<padding>
<Insets left="10.0" right="10.0" />
</padding>
</GridPane>
</children>
</VBox>
</children>
<padding>
<Insets left="71.75" right="71.75" />
</padding>
</HBox>
<HBox alignment="CENTER" layoutY="462.0" prefHeight="51.0" prefWidth="277.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="462.0">
<children>
<JFXButton fx:id="addButton" mnemonicParsing="false" onAction="#addAction" prefWidth="70.0" text="ADD">
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
<padding>
<Insets bottom="6.0" left="6.0" right="6.0" top="6.0" />
</padding>
</JFXButton>
<JFXButton fx:id="updateButton" mnemonicParsing="false" onAction="#updateSalesDataAction" prefWidth="70.0" text="UPDATE">
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
<padding>
<Insets bottom="6.0" left="6.0" right="6.0" top="6.0" />
</padding>
</JFXButton>
<JFXButton fx:id="clearButton" mnemonicParsing="false" onAction="#clearAction" prefWidth="70.0" text="CLEAR">
<padding>
<Insets bottom="6.0" left="6.0" right="6.0" top="6.0" />
</padding>
<HBox.margin>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</HBox.margin>
</JFXButton>
</children>
</HBox>
<HBox alignment="CENTER" layoutX="502.0" layoutY="521.0" prefHeight="33.0" prefWidth="277.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="521.0" />
<HBox layoutY="29.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children>
<Label alignment="CENTER" prefHeight="55.0" prefWidth="279.0" styleClass="label-color" text="Info A" textAlignment="CENTER">
<font>
<Font name="System Bold" size="18.0" />
</font>
<HBox.margin>
<Insets left="41.0" />
</HBox.margin>
</Label>
<Label alignment="CENTER" prefHeight="55.0" prefWidth="279.0" styleClass="label-color" text="Info B" textAlignment="CENTER">
<font>
<Font name="System Bold" size="18.0" />
</font>
<HBox.margin>
<Insets left="123.75" right="97.75" />
</HBox.margin>
</Label>
<Label alignment="CENTER" prefHeight="55.0" prefWidth="279.0" styleClass="label-color" text="Info C" textAlignment="CENTER">
<font>
<Font name="System Bold" size="18.0" />
</font>
<HBox.margin>
<Insets left="26.0" />
</HBox.margin>
</Label>
</children>
<padding>
<Insets left="71.75" right="71.75" />
</padding>
</HBox>
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</JFXTabPane>
</children>
</AnchorPane>

Related

How can I make the JavaFx scene responsive?

public class DoctorsController implements Initializable {
#FXML
private JFXComboBox<String> comboSpecialization;
#FXML
private JFXComboBox<String> comboDepartment;
#FXML
private ToggleGroup q;
/**
* Initializes the controller class.
* #param url
* #param rb
*/
#Override
public void initialize(URL url, ResourceBundle rb) {
// Populate Comboboxe with static options,
comboSpecialization.getItems().addAll("Pychologist","Psychiatric","Gynaecologist"
+"Pathologist","Cardiologist","Orginologist","unspecified");
comboSpecialization.getSelectionModel().selectLast();
comboDepartment.getItems().addAll("Pychology","Maternity","OutPatient"
+ "Mourtuary","Others");
comboDepartment.getSelectionModel().selectLast();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXComboBox?>
<?import com.jfoenix.controls.JFXProgressBar?>
<?import com.jfoenix.controls.JFXRadioButton?>
<?import com.jfoenix.controls.JFXTabPane?>
<?import com.jfoenix.controls.JFXTextArea?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<AnchorPane id="AnchorPane" prefHeight="684.0" prefWidth="1105.0" stylesheets="#../styles/styles.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="doctors.DoctorsController">
<children>
<JFXTabPane layoutX="138.0" layoutY="100.0" prefHeight="684.0" prefWidth="1105.0" tabClosingPolicy="UNAVAILABLE" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<tabs>
<Tab text="MANAGE DOCOTRS">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<HBox layoutX="23.0" layoutY="33.0" prefHeight="135.0" prefWidth="1068.0" spacing="30.0">
<children>
<AnchorPane prefHeight="110.0" prefWidth="393.0" style="-fx-background-color: #00ADD8;" styleClass="card-unpadded">
<children>
<Pane layoutX="-1.0" prefHeight="141.0" prefWidth="23.0" style="-fx-background-color: #007390;" />
<ImageView fitHeight="97.0" fitWidth="124.0" layoutX="33.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="#../imgs/doctor.png" />
</image>
</ImageView>
<Label layoutX="182.0" layoutY="14.0" prefHeight="67.0" prefWidth="89.0" styleClass="custom-white-title-label" text="16" />
<Label layoutX="182.0" layoutY="76.0" prefHeight="31.0" prefWidth="210.0" styleClass="custom-white-label" text="Registered doctors" />
<Label layoutX="182.0" layoutY="107.0" prefHeight="33.0" prefWidth="210.0" styleClass="custom-white-label" text="We need you." />
</children>
</AnchorPane>
<AnchorPane prefHeight="166.0" prefWidth="393.0" style="-fx-background-color: #DD4B39;" styleClass="card-unpadded">
<children>
<Pane layoutX="-1.0" prefHeight="166.0" prefWidth="23.0" style="-fx-background-color: #C74433;" />
<ImageView fitHeight="125.0" fitWidth="124.0" layoutX="33.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="#../imgs/Appointment.png" />
</image>
</ImageView>
<Label layoutX="209.0" layoutY="14.0" prefHeight="67.0" prefWidth="89.0" styleClass="custom-white-title-label" text="57 of 100 " />
<Label layoutX="182.0" layoutY="76.0" prefHeight="31.0" prefWidth="210.0" styleClass="custom-white-label" text="Unattended appointments" />
<JFXProgressBar layoutX="179.0" layoutY="120.0" progress="0.52" />
</children>
</AnchorPane>
<AnchorPane prefHeight="157.0" prefWidth="205.0" style="-fx-background-color: #F39C12;" styleClass="card">
<children>
<VBox layoutX="14.0" layoutY="14.0" prefHeight="85.0" prefWidth="159.0">
<children>
<Label prefHeight="31.0" prefWidth="153.0" styleClass="custom-white-title-label" text="TODAY" />
<Label prefHeight="20.0" prefWidth="152.0" styleClass="custom-white-title-label" text="Monday" />
<Label prefHeight="20.0" prefWidth="151.0" styleClass="custom-white-title-label" text="12/07/2017" />
</children>
</VBox>
<ImageView fitHeight="31.0" fitWidth="50.0" layoutX="143.0" layoutY="102.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="#../imgs/Copyright.png" />
</image>
</ImageView>
</children>
</AnchorPane>
</children>
</HBox>
<AnchorPane layoutX="23.0" layoutY="224.0" prefHeight="413.0" prefWidth="1057.0" styleClass="card-unpadded">
<children>
<VBox layoutX="20.0" layoutY="14.0" prefHeight="380.0" prefWidth="415.0" spacing="10.0">
<children>
<JFXTextField focusColor="#00add8" labelFloat="true" promptText="First Name" unFocusColor="#868282" />
<JFXTextField focusColor="#00add8" labelFloat="true" layoutX="10.0" layoutY="10.0" promptText="Last Name" unFocusColor="#868282" />
<JFXTextField focusColor="#00add8" labelFloat="true" layoutX="10.0" layoutY="46.0" promptText="Email address" unFocusColor="#868282" />
<JFXTextField focusColor="#00add8" labelFloat="true" layoutX="10.0" layoutY="82.0" promptText="Phone Number" unFocusColor="#868282" />
<JFXTextField focusColor="#00add8" labelFloat="true" layoutX="10.0" layoutY="118.0" promptText="Identity Number" unFocusColor="#868282" />
<JFXTextArea maxWidth="404.0" minWidth="404.0" prefHeight="98.0" prefWidth="404.0" promptText="Additional Information" />
</children>
<padding>
<Insets left="20.0" top="10.0" />
</padding>
</VBox>
<VBox layoutX="525.0" layoutY="17.0" prefHeight="376.0" prefWidth="511.0" spacing="10.0">
<children>
<VBox prefHeight="82.0" prefWidth="541.0">
<children>
<Label style="-fx-text-fill: #868282;" text="Level of Specialization" />
<JFXComboBox fx:id="comboSpecialization" prefHeight="40.0" prefWidth="494.0">
<VBox.margin>
<Insets left="100.0" />
</VBox.margin>
</JFXComboBox>
</children>
</VBox>
<VBox layoutX="10.0" layoutY="10.0" prefHeight="82.0" prefWidth="541.0">
<children>
<Label prefHeight="20.0" prefWidth="112.0" style="-fx-text-fill: #868282;" text="Department" />
<JFXComboBox fx:id="comboDepartment" prefHeight="40.0" prefWidth="499.0">
<VBox.margin>
<Insets left="100.0" />
</VBox.margin>
</JFXComboBox>
</children>
</VBox>
<VBox layoutX="10.0" layoutY="92.0" prefHeight="82.0" prefWidth="541.0">
<children>
<Label prefHeight="20.0" prefWidth="222.0" style="-fx-text-fill: #868282;" text="Taking Appointments" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="30.0">
<children>
<JFXRadioButton selected="true" text="YES">
<toggleGroup>
<ToggleGroup fx:id="q" />
</toggleGroup></JFXRadioButton>
<JFXRadioButton layoutX="10.0" layoutY="10.0" text="NO" toggleGroup="$q" />
</children>
<padding>
<Insets left="100.0" right="20.0" />
</padding>
</HBox>
</children>
</VBox>
<Separator prefWidth="200.0" />
<HBox alignment="CENTER_RIGHT" prefHeight="77.0" prefWidth="511.0" spacing="20.0">
<children>
<JFXButton styleClass="cancel-button" text="Cancel" />
<JFXButton prefHeight="27.0" prefWidth="78.0" styleClass="green-btn" text="Edit" />
<JFXButton layoutX="72.0" layoutY="10.0" prefHeight="37.0" prefWidth="100.0" styleClass="blue-btn" text="Save" />
</children>
<padding>
<Insets right="20.0" />
</padding>
</HBox>
</children>
<padding>
<Insets left="20.0" top="20.0" />
</padding>
</VBox>
</children>
</AnchorPane>
</children>
</AnchorPane>
</content>
</Tab>
<Tab text="DETAILS">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
<children>
<SplitPane dividerPositions="0.6173228346456693" layoutX="16.0" layoutY="6.0" orientation="VERTICAL" prefHeight="649.0" prefWidth="1105.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="388.0" prefWidth="1103.0">
<children>
<TextField layoutX="787.0" layoutY="14.0" prefHeight="30.0" prefWidth="302.0" promptText="Search doctor by name" styleClass="search-box" />
<TableView layoutX="11.0" layoutY="53.0" prefHeight="326.0" prefWidth="1080.0">
<columns>
<TableColumn editable="false" prefWidth="389.0" text="C1" />
<TableColumn editable="false" prefWidth="168.0" sortable="false" text="C2" />
<TableColumn editable="false" prefWidth="171.0" sortable="false" text="C2" />
<TableColumn editable="false" prefWidth="250.0" sortable="false" text="C2" />
</columns>
</TableView>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="240.0" prefWidth="1103.0">
<children>
<HBox layoutX="30.0" layoutY="14.0" prefHeight="210.0" prefWidth="1043.0" spacing="30.0">
<children>
<GridPane prefHeight="219.0" prefWidth="493.0" styleClass="card">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="195.0" minWidth="10.0" prefWidth="106.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="321.0" minWidth="10.0" prefWidth="321.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Personal Details" />
<Label prefHeight="20.0" prefWidth="83.0" text="Contacts" GridPane.rowIndex="4" />
<Label prefHeight="20.0" prefWidth="300.0" styleClass="blue-label" text="ID No 30229182" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label prefHeight="20.0" prefWidth="300.0" styleClass="blue-label" text="Doctor" GridPane.columnIndex="1" />
<Label prefHeight="20.0" prefWidth="300.0" styleClass="blue-label" text="Daniel" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label prefHeight="20.0" prefWidth="300.0" styleClass="blue-label" text="Mungatana" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label prefHeight="20.0" prefWidth="300.0" styleClass="green-label" text="0717160344" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label prefHeight="20.0" prefWidth="300.0" styleClass="green-label" text="danmlayah#gmail.com" GridPane.columnIndex="1" GridPane.rowIndex="5" />
</children>
</GridPane>
<GridPane prefHeight="219.0" prefWidth="520.0" styleClass="card">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="239.0" minWidth="10.0" prefWidth="186.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="302.0" minWidth="10.0" prefWidth="302.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Speciality" />
<Label text="Taking Appointments ?" GridPane.rowIndex="2" />
<Label text="Pending Appointments" GridPane.rowIndex="3" />
<Label prefHeight="20.0" prefWidth="280.0" styleClass="yellow-label" text="Cardiologist" GridPane.columnIndex="1" />
<Label prefHeight="20.0" prefWidth="280.0" styleClass="yellow-label" text="Department of Cardiology" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label prefHeight="20.0" prefWidth="279.0" styleClass="red-label" text="YES" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="5.0" GridPane.columnIndex="1" GridPane.rowIndex="3">
<children>
<Label alignment="CENTER" contentDisplay="CENTER" prefHeight="30.0" prefWidth="98.0" style="-fx-font-weight: bold;" styleClass="green-label" text="12" />
<JFXButton buttonType="RAISED" prefHeight="30.0" prefWidth="99.0" style="-fx-background-color: rgb(0, 166, 90); -fx-text-fill: white; -fx-font-size: 14; -fx-font-weight: bold;" text="View" />
</children>
</HBox>
<JFXButton buttonType="RAISED" ripplerFill="#53eb11" styleClass="blue-btn" text="Edit Info" GridPane.columnIndex="1" GridPane.rowIndex="5" />
</children>
</GridPane>
</children>
</HBox>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
</content>
</Tab>
</tabs>
</JFXTabPane>
</children>
</AnchorPane>
I am using scene builder for building the application.
I have added several panes and image views inside a scene right now i have a fixed resolution of 1366*768, which works fine.
But when the resolution is not matched the elements in the scene are not aligned properly , is there any solution to fix this issue.
Application running on 800*600 resolution
Application running on 1024*768 resolution
Appplication running on 1366*768 resolution

make anchorpane resizable with size of screen

How to bind an AnchorPane to the size of the screen?
When I run my code it shows me that:
but when the main stage fit the screen the AnchorPane still has the same size.
here is my fxml file
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="768.0" prefWidth="1024.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sanad.Entry_Page">
<children>
<Pane blendMode="RED" layoutX="563.0" layoutY="9.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minWidth="-Infinity" prefHeight="746.0" prefWidth="447.0">
<padding>
<Insets top="10.0" />
</padding>
<children>
<SplitPane dividerPositions="0.5720620842572062" layoutX="-56.0" layoutY="-1.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="741.0" prefWidth="508.0">
<items>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="751.0" prefWidth="286.0">
<children>
<TextField fx:id="formnumer_field" layoutX="8.0" layoutY="14.0" prefHeight="30.0" prefWidth="235.0" />
<TextField fx:id="sectornumber_field" layoutX="8.0" layoutY="48.0" prefHeight="30.0" prefWidth="235.0" />
<TextField fx:id="fathername_field" layoutX="8.0" layoutY="82.0" prefHeight="30.0" prefWidth="235.0" />
<ComboBox fx:id="fatherborn_year" layoutX="8.0" layoutY="116.0" prefHeight="25.0" prefWidth="70.0" />
<ComboBox fx:id="fatherborn_month" layoutX="85.0" layoutY="116.0" prefHeight="25.0" prefWidth="70.0" />
<ComboBox fx:id="fatherborn_day" layoutX="162.0" layoutY="116.0" prefHeight="25.0" prefWidth="80.0" />
<TextField fx:id="fathercurrentjob" layoutX="8.0" layoutY="145.0" prefHeight="30.0" prefWidth="235.0" />
<TextField fx:id="fatherprevjob" layoutX="8.0" layoutY="179.0" prefHeight="30.0" prefWidth="235.0" />
<TextField fx:id="mothername_field" layoutX="8.0" layoutY="215.0" prefHeight="30.0" prefWidth="235.0" />
<TextField fx:id="mother_curr_job" layoutX="8.0" layoutY="278.0" prefHeight="30.0" prefWidth="235.0" />
<ComboBox fx:id="motherborn_day" layoutX="162.0" layoutY="249.0" prefHeight="25.0" prefWidth="80.0" />
<ComboBox fx:id="motherborn_year" layoutX="8.0" layoutY="249.0" prefHeight="25.0" prefWidth="70.0" />
<TextField fx:id="mother_prev_job" layoutX="8.0" layoutY="312.0" prefHeight="30.0" prefWidth="235.0" />
<ComboBox fx:id="motherborn_month" layoutX="85.0" layoutY="249.0" prefHeight="25.0" prefWidth="70.0" />
<TextField fx:id="homepartner_num" layoutX="8.0" layoutY="346.0" prefHeight="30.0" prefWidth="235.0" />
<ComboBox fx:id="homepartner_year" layoutX="11.0" layoutY="382.0" prefHeight="25.0" prefWidth="70.0" />
<ComboBox fx:id="homepartner_month" layoutX="88.0" layoutY="382.0" prefHeight="25.0" prefWidth="70.0" />
<ComboBox fx:id="homepartner_day" layoutX="163.0" layoutY="382.0" prefHeight="25.0" prefWidth="80.0" />
<ComboBox fx:id="homepartner_name" layoutX="8.0" layoutY="416.0" prefHeight="30.0" prefWidth="235.0" />
<CheckBox fx:id="homepartner_gender1" layoutX="141.0" layoutY="456.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="100.0" text="ذكر">
<font>
<Font size="14.0" />
</font>
</CheckBox>
<CheckBox fx:id="homepartner_gender2" layoutX="8.0" layoutY="456.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="100.0" text="أنثى">
<font>
<Font size="14.0" />
</font>
</CheckBox>
<Label fx:id="current_cityaa" alignment="CENTER" layoutX="141.0" layoutY="490.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="المحافظة">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="current_city" layoutX="8.0" layoutY="490.0" prefHeight="30.0" prefWidth="120.0" />
<Label fx:id="current_cityaa1" alignment="CENTER" layoutX="141.0" layoutY="530.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="الحي">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="current_suberb" layoutX="8.0" layoutY="530.0" prefHeight="30.0" prefWidth="120.0" />
<TextField fx:id="prev_suberb" layoutX="11.0" layoutY="615.0" prefHeight="30.0" prefWidth="120.0" />
<Label fx:id="current_cityaa11" alignment="CENTER" layoutX="144.0" layoutY="615.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="الحي">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="current_cityaa2" alignment="CENTER" layoutX="144.0" layoutY="575.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="المحافظة">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="prev_city" layoutX="11.0" layoutY="575.0" prefHeight="30.0" prefWidth="120.0" />
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<Label fx:id="formnumber" contentDisplay="RIGHT" layoutX="8.0" layoutY="14.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="رقم الاستمارة" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<padding>
<Insets left="50.0" />
</padding>
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="sectornumber" contentDisplay="RIGHT" layoutX="8.0" layoutY="48.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="رقم القطاع" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fathername" contentDisplay="RIGHT" layoutX="8.0" layoutY="82.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="اسم الأب" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fatherborn" contentDisplay="RIGHT" layoutX="20.0" layoutY="112.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="المواليد" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="currentjob" contentDisplay="RIGHT" layoutX="20.0" layoutY="142.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل الحالي" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="previousjob" contentDisplay="RIGHT" layoutX="20.0" layoutY="172.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل السابق" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fatherborn1" contentDisplay="RIGHT" layoutX="20.0" layoutY="244.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="المواليد" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="currentjob1" contentDisplay="RIGHT" layoutX="20.0" layoutY="278.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل الحالي" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fathername1" contentDisplay="RIGHT" layoutX="8.0" layoutY="208.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="اسم الأم" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="previousjob1" contentDisplay="RIGHT" layoutX="20.0" layoutY="307.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل السابق" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="homepartner_sex" contentDisplay="RIGHT" layoutX="20.0" layoutY="451.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="الجنس" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="homepartner_name" contentDisplay="RIGHT" layoutX="20.0" layoutY="414.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="الاسم" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="partner_born" contentDisplay="RIGHT" layoutX="20.0" layoutY="378.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="الميلاد" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="home_partner" contentDisplay="RIGHT" layoutX="8.0" layoutY="341.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="عدد المستضافين" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label alignment="CENTER" layoutX="8.0" layoutY="485.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="175.0" text="السكن الحالي">
<font>
<Font size="14.0" />
</font>
</Label>
<Label alignment="CENTER" layoutX="8.0" layoutY="570.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="175.0" text="السكن الحالي">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</Pane>
<SplitPane dividerPositions="0.4845360824742268" layoutX="8.0" layoutY="8.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="741.0" prefWidth="487.0">
<items>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="327.0" prefWidth="100.0" />
</items>
</SplitPane>
</children>
</AnchorPane>
This can be done using this property of AnchorPane:
AnchorPane.bottomAnchor
AnchorPane.leftAnchor
AnchorPane.rightAnchor
AnchorPane.topAnchor
But you need to decide what part of a scene will change and what is not. The width of the fixed part fix with prefWidth. Сhanging part fix with AnchorPane.leftAnchor or AnchorPane.rightAnchor given the size of the fixed part.
Sample:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sanad.Entry_Page">
<children>
<Accordion prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
<panes>
<TitledPane animated="false" text="untitled 1">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane animated="false" text="untitled 2">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane animated="false" text="untitled 3">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
</TitledPane>
</panes>
</Accordion>
<SplitPane dividerPositions="0.5" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="200.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<LineChart AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<xAxis>
<CategoryAxis side="BOTTOM" />
</xAxis>
<yAxis>
<NumberAxis side="LEFT" />
</yAxis>
</LineChart>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<TableView prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columns>
<TableColumn prefWidth="75.0" text="C1" />
<TableColumn prefWidth="75.0" text="C2" />
</columns>
</TableView>
</children>
</AnchorPane>
</items>
</SplitPane>
</children>
</AnchorPane>
I try do something with this fxml, but i think that is bad created. You should rebuild everything. For right site is better to use GridPane not AnchorPane and put all elements in grid.
I created HBox in this hobx I put two AnchorPane, then each AnchorPane i put Your SplitPane. After this you must connect each SplitPane with right and left edge of AnchorPane like this:
<SplitPane AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
Here is this fxml:
Use SceneBuilder to preview how it works.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<HBox id="AnchorPane" prefHeight="786.0" prefWidth="1024.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
<AnchorPane prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children>
<SplitPane dividerPositions="0.4845360824742268" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="741.0" prefWidth="487.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<items>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="327.0" prefWidth="100.0" />
</items>
</SplitPane>
</children>
</AnchorPane>
<AnchorPane prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS">
<children>
<SplitPane dividerPositions="0.5720620842572062" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="741.0" prefWidth="508.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<items>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" nodeOrientation="LEFT_TO_RIGHT">
<children>
<TextField fx:id="formnumer_field" layoutX="8.0" layoutY="14.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="43.0" />
<TextField fx:id="sectornumber_field" layoutX="8.0" layoutY="48.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="43.0" />
<TextField fx:id="fathername_field" layoutX="8.0" layoutY="82.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="43.0" />
<ComboBox fx:id="fatherborn_year" layoutX="8.0" layoutY="116.0" prefHeight="25.0" prefWidth="70.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="226.0" />
<ComboBox fx:id="fatherborn_month" layoutX="85.0" layoutY="116.0" prefHeight="25.0" prefWidth="70.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="226.0" />
<ComboBox fx:id="fatherborn_day" layoutX="162.0" layoutY="116.0" prefHeight="25.0" prefWidth="80.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="226.0" />
<TextField fx:id="fathercurrentjob" layoutX="8.0" layoutY="145.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<TextField fx:id="fatherprevjob" layoutX="8.0" layoutY="179.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<TextField fx:id="mothername_field" layoutX="8.0" layoutY="215.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<TextField fx:id="mother_curr_job" layoutX="8.0" layoutY="278.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<ComboBox fx:id="motherborn_day" layoutX="162.0" layoutY="249.0" prefHeight="25.0" prefWidth="80.0" AnchorPane.rightAnchor="73.0" />
<ComboBox fx:id="motherborn_year" layoutX="8.0" layoutY="249.0" prefHeight="25.0" prefWidth="70.0" />
<TextField fx:id="mother_prev_job" layoutX="8.0" layoutY="312.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<ComboBox fx:id="motherborn_month" layoutX="85.0" layoutY="249.0" nodeOrientation="LEFT_TO_RIGHT" />
<TextField fx:id="homepartner_num" layoutX="8.0" layoutY="346.0" prefHeight="30.0" prefWidth="235.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<ComboBox fx:id="homepartner_year" layoutX="11.0" layoutY="382.0" />
<ComboBox fx:id="homepartner_month" layoutX="88.0" layoutY="382.0" />
<ComboBox fx:id="homepartner_day" layoutX="163.0" layoutY="382.0" />
<ComboBox fx:id="homepartner_name" layoutX="8.0" layoutY="416.0" AnchorPane.leftAnchor="8.0" AnchorPane.rightAnchor="72.0" />
<CheckBox fx:id="homepartner_gender1" layoutX="141.0" layoutY="456.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="100.0" text="ذكر">
<font>
<Font size="14.0" />
</font>
</CheckBox>
<CheckBox fx:id="homepartner_gender2" layoutX="8.0" layoutY="456.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="100.0" text="أنثى">
<font>
<Font size="14.0" />
</font>
</CheckBox>
<Label fx:id="current_cityaa" alignment="CENTER" layoutX="141.0" layoutY="490.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="المحافظة" AnchorPane.rightAnchor="74.0">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="current_city" layoutX="8.0" layoutY="490.0" AnchorPane.leftAnchor="8.0" />
<Label fx:id="current_cityaa1" alignment="CENTER" layoutX="141.0" layoutY="530.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="الحي" AnchorPane.rightAnchor="74.0">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="current_suberb" layoutX="8.0" layoutY="530.0" AnchorPane.leftAnchor="8.0" />
<TextField fx:id="prev_suberb" layoutX="11.0" layoutY="615.0" AnchorPane.leftAnchor="11.0" />
<Label fx:id="current_cityaa11" alignment="CENTER" layoutX="144.0" layoutY="615.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="الحي" AnchorPane.rightAnchor="71.0">
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="current_cityaa2" alignment="CENTER" layoutX="144.0" layoutY="575.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="100.0" text="المحافظة" AnchorPane.rightAnchor="71.0">
<font>
<Font size="14.0" />
</font>
</Label>
<TextField fx:id="prev_city" layoutX="11.0" layoutY="575.0" AnchorPane.leftAnchor="11.0" />
</children>
</AnchorPane>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<Label fx:id="formnumber" contentDisplay="RIGHT" layoutX="8.0" layoutY="14.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="رقم الاستمارة" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<padding>
<Insets left="50.0" />
</padding>
<font>
<Font size="14.0" />
</font>
</Label>
<Label fx:id="sectornumber" contentDisplay="RIGHT" layoutX="8.0" layoutY="48.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="رقم القطاع" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fathername" contentDisplay="RIGHT" layoutX="8.0" layoutY="82.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="اسم الأب" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fatherborn" contentDisplay="RIGHT" layoutX="20.0" layoutY="112.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="المواليد" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="currentjob" contentDisplay="RIGHT" layoutX="20.0" layoutY="142.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل الحالي" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="previousjob" contentDisplay="RIGHT" layoutX="20.0" layoutY="172.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل السابق" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fatherborn1" contentDisplay="RIGHT" layoutX="20.0" layoutY="244.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="المواليد" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="currentjob1" contentDisplay="RIGHT" layoutX="20.0" layoutY="278.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل الحالي" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="fathername1" contentDisplay="RIGHT" layoutX="8.0" layoutY="208.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="اسم الأم" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="previousjob1" contentDisplay="RIGHT" layoutX="20.0" layoutY="307.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="العمل السابق" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="homepartner_sex" contentDisplay="RIGHT" layoutX="20.0" layoutY="451.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="الجنس" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="homepartner_name" contentDisplay="RIGHT" layoutX="20.0" layoutY="414.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="الاسم" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="partner_born" contentDisplay="RIGHT" layoutX="20.0" layoutY="378.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="127.0" text="الميلاد" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label fx:id="home_partner" contentDisplay="RIGHT" layoutX="8.0" layoutY="341.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="174.0" text="عدد المستضافين" textAlignment="RIGHT" textOverrun="CENTER_ELLIPSIS">
<font>
<Font size="14.0" />
</font>
<padding>
<Insets left="50.0" />
</padding>
</Label>
<Label alignment="CENTER" layoutX="8.0" layoutY="485.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="175.0" text="السكن الحالي">
<font>
<Font size="14.0" />
</font>
</Label>
<Label alignment="CENTER" layoutX="8.0" layoutY="570.0" nodeOrientation="RIGHT_TO_LEFT" prefHeight="30.0" prefWidth="175.0" text="السكن الحالي">
<font>
<Font size="14.0" />
</font>
</Label>
</children>
</AnchorPane>
</items>
</SplitPane>
<Pane blendMode="RED" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minWidth="-Infinity" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<padding>
<Insets top="10.0" />
</padding>
</Pane>
</children>
</AnchorPane>
</HBox>

How to get same vertical size of TitledPanes in a Gridpane? (JavaFX, Scenebuilder)

i have a problem with the vertical size of the right TiteldPane (see picture below). Both TitledPanes are put in a GridPane. I want that the smaller one gets the same height like the left one. I tried to set the Vgrow to "always" of the right TitledPane, but nothing happened. Also i tried to do something with a Region without a success. Is this possible without giving them an absolut height?
Thanks for your help in advance.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<AnchorPane xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ScrollPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane>
<children>
<GridPane hgap="20.0" vgap="20.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints valignment="TOP" vgrow="ALWAYS" />
</rowConstraints>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
<children>
<TitledPane animated="false" text="TitledPane">
<content>
<GridPane hgap="10.0" vgap="5.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Label" GridPane.halignment="RIGHT" />
<Label GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Label" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<Label GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="Label" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
<Label GridPane.columnIndex="1" GridPane.rowIndex="5" />
<TextField GridPane.columnIndex="1" />
<TextField GridPane.columnIndex="1" GridPane.rowIndex="2" />
<TextField fx:id="abgar10TF" GridPane.columnIndex="1" GridPane.rowIndex="4" />
</children>
</GridPane>
</content>
</TitledPane>
<TitledPane animated="false" text="TitledPane" GridPane.columnIndex="1" GridPane.valignment="TOP" GridPane.vgrow="ALWAYS">
<content>
<GridPane hgap="10.0" vgap="5.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Label" GridPane.halignment="RIGHT" />
<Label GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Label" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
<Label GridPane.columnIndex="1" GridPane.rowIndex="3" />
<TextField GridPane.columnIndex="1" />
<TextField GridPane.columnIndex="1" GridPane.rowIndex="2" />
</children>
</GridPane>
</content>
</TitledPane>
</children>
</GridPane>
</children>
</AnchorPane>
</content>
</ScrollPane>
</children>
</AnchorPane>
You have to set max height for both TitlePanes to MAX_VALUE

When clicking a button, or resize window, the layout moves, "jumps".

This question is similar to FXML - Text Field Moves To The Right Upon Button Click but it doesn´t help my case.
I have a BorderPane, with a logo/text in the top, and the main contents in center.
<BorderPane id="mainpane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="900.0" prefWidth="1200.0" stylesheets="#/css/biomat.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<top>
<HBox id="maintop" alignment="CENTER" prefHeight="150.0" prefWidth="200.0" BorderPane.alignment="CENTER_LEFT">
<children>
<Label text="Header">
<font>
<Font name="Verdana" size="48.0" />
</font>
</Label>
</children>
</HBox>
</top>
<center>
<VBox id="maincenter" alignment="CENTER" prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER">
<children>
<ProgressIndicator prefHeight="97.0" prefWidth="800.0" />
<Label text="Loading...">
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</Label>
</children>
</VBox>
</center>
</BorderPane>
The main contents is a couple of buttons which are displayed after some loading is done:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.Font?>
<VBox fx:id="mainmenupane" alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefHeight="0" prefWidth="0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controllers.MainMenuController">
<children>
<GridPane maxHeight="1.7976931348623157E308" VBox.vgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints halignment="CENTER" hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="CENTER" hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" valignment="CENTER" vgrow="ALWAYS" />
</rowConstraints>
<children>
<Button id="button1" alignment="CENTER" maxHeight="100.0" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Button 1" GridPane.columnIndex="0">
<font>
<Font size="24.0" />
</font>
<GridPane.margin>
<Insets bottom="10.0" left="50.0" right="50.0" top="10.0" />
</GridPane.margin>
</Button>
<Button id="button2" alignment="CENTER" maxHeight="100.0" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Button 2" GridPane.columnIndex="1">
<font>
<Font size="24.0" />
</font>
<GridPane.margin>
<Insets bottom="10.0" left="50.0" right="50.0" top="10.0" />
</GridPane.margin>
</Button>
</children>
</GridPane>
<GridPane maxHeight="1.7976931348623157E308" VBox.vgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints halignment="CENTER" hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints halignment="CENTER" hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="ALWAYS" valignment="CENTER" />
</rowConstraints>
<children>
<Button fx:id="button3" alignment="CENTER" maxHeight="100.0" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Button 3" GridPane.columnIndex="0">
<font>
<Font size="24.0" />
</font>
<GridPane.margin>
<Insets bottom="10.0" left="50.0" right="50.0" top="10.0" />
</GridPane.margin>
</Button>
</children>
</GridPane>
<GridPane alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" VBox.vgrow="ALWAYS">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="ALWAYS" valignment="CENTER" />
</rowConstraints>
<children>
<Button fx:id="button4" alignment="CENTER" mnemonicParsing="false" text="Button 4" GridPane.halignment="CENTER" GridPane.hgrow="ALWAYS">
<font>
<Font size="24.0" />
</font>
</Button>
</children>
</GridPane>
</children>
</VBox>
Now the interesting part that I don´t understand. Click all but the first (#button1) button and the whole layout moves upward a couple of pixels, it happens once, then the layout has "settled".
A workaround I found, is to force a layout pass after I have added the contents with the buttons.
borderPane.setCenter(node);
borderPane.layout();
Obviously I don´t like the above solution, instead I want to understand why the layout has not settled correctly in the first place.

resize stage components when resizing stage

The below screen shot is the default size of stage
when resized
how to resize the inner components when resizing the stage window accordingly?
<AnchorPane fx:id="mainpane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="809.0" prefWidth="860.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxhomeui_1.HomeUI_2Controller">
<children>
<VBox layoutX="695.0" layoutY="137.0" AnchorPane.bottomAnchor="341.0" AnchorPane.leftAnchor="695.0" AnchorPane.rightAnchor="-2.0" AnchorPane.topAnchor="137.0">
<children>
<SplitPane fx:id="sidebar" layoutX="695.0" layoutY="137.0" prefHeight="331.0" prefWidth="167.0" AnchorPane.bottomAnchor="341.0" AnchorPane.leftAnchor="695.0" AnchorPane.rightAnchor="-2.0" AnchorPane.topAnchor="137.0" />
</children>
</VBox>
<HBox layoutX="37.0" layoutY="163.0" AnchorPane.bottomAnchor="38.0" AnchorPane.leftAnchor="37.0" AnchorPane.rightAnchor="257.0" AnchorPane.topAnchor="163.0">
<children>
<ScrollPane fx:id="displayscroll" layoutX="37.0" layoutY="163.0" prefHeight="608.0" prefWidth="566.0" AnchorPane.bottomAnchor="29.0" AnchorPane.leftAnchor="37.0" AnchorPane.rightAnchor="197.0" AnchorPane.topAnchor="163.0">
<content>
<GridPane fx:id="gridpane" prefHeight="383.0" prefWidth="449.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
</content>
</ScrollPane>
</children>
</HBox>
<Pane layoutX="573.0" layoutY="46.0" AnchorPane.bottomAnchor="738.0" AnchorPane.leftAnchor="573.0" AnchorPane.rightAnchor="107.0" AnchorPane.topAnchor="46.0">
<children>
<ComboBox fx:id="categorycmb" prefHeight="25.0" prefWidth="180.0" />
</children>
</Pane>
<Pane layoutX="110.0" layoutY="108.0" AnchorPane.bottomAnchor="672.0" AnchorPane.leftAnchor="110.0" AnchorPane.rightAnchor="461.0" AnchorPane.topAnchor="108.0">
<children>
<ToggleButton fx:id="gamestbutton" layoutX="76.0" layoutY="4.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="71.0" stylesheets="#Togglebutton.css" text="Games" AnchorPane.topAnchor="112.0" />
<ToggleButton fx:id="songstbutton" layoutX="218.0" layoutY="4.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="71.0" stylesheets="#Togglebutton.css" text="Songs" AnchorPane.topAnchor="112.0" />
<ToggleButton fx:id="apptbutton" layoutX="5.0" layoutY="4.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="71.0" stylesheets="#Togglebutton.css" text="Apps" AnchorPane.topAnchor="112.0" />
<ToggleButton fx:id="moviestbutton" layoutX="147.0" layoutY="4.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="71.0" stylesheets="#Togglebutton.css" text="Movies" AnchorPane.topAnchor="112.0" />
</children>
</Pane>
<Pane layoutX="92.0" layoutY="44.0" AnchorPane.bottomAnchor="737.0" AnchorPane.leftAnchor="92.0" AnchorPane.rightAnchor="347.0" AnchorPane.topAnchor="44.0">
<children>
<TextField fx:id="searchtxt" prefHeight="28.0" prefWidth="421.0" promptText="Search" AnchorPane.bottomAnchor="737.0" AnchorPane.leftAnchor="92.0" AnchorPane.rightAnchor="347.0" AnchorPane.topAnchor="44.0" />
</children>
</Pane>
</children>
</AnchorPane>
FXML code (above) scrollpane and splitpane enclosed inside HBox and VBox respectively.
Also I want to keep space between images..

Resources