Skip to content

Instantly share code, notes, and snippets.

@Da9el00
Created August 1, 2022 07:26
Show Gist options
  • Save Da9el00/56436960cd49328c4da7cf62a587eadc to your computer and use it in GitHub Desktop.
Save Da9el00/56436960cd49328c4da7cf62a587eadc to your computer and use it in GitHub Desktop.
JavaFX - Resizable window using h- and v-boxes
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<HBox maxHeight="100.0" style="-fx-background-color: #224455;" VBox.vgrow="ALWAYS" />
<HBox VBox.vgrow="ALWAYS">
<children>
<HBox style="-fx-background-color: #001199;" HBox.hgrow="ALWAYS" />
<VBox maxWidth="450.0" HBox.hgrow="ALWAYS">
<children>
<VBox style="-fx-background-color: #111111;" VBox.vgrow="ALWAYS" />
<AnchorPane maxHeight="350.0" maxWidth="450.0" minHeight="350.0" minWidth="450.0" VBox.vgrow="ALWAYS">
<children>
<Button layoutX="199.0" layoutY="284.0" mnemonicParsing="false" text="Button" />
<TextArea layoutX="91.0" layoutY="69.0" prefHeight="195.0" prefWidth="269.0" />
<Text layoutX="214.0" layoutY="55.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" />
</children>
</AnchorPane>
<VBox layoutX="10.0" layoutY="10.0" style="-fx-background-color: #111111;" VBox.vgrow="ALWAYS" />
</children>
</VBox>
<HBox style="-fx-background-color: #110099;" HBox.hgrow="ALWAYS" />
</children></HBox>
<HBox maxHeight="100.0" style="-fx-background-color: #112233;" VBox.vgrow="ALWAYS" />
</children>
</VBox>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment