Skip to content

Instantly share code, notes, and snippets.

@ennerf
Last active May 28, 2022 19:04
Show Gist options
  • Select an option

  • Save ennerf/31d0040799aed9a690b0a2629da141b7 to your computer and use it in GitHub Desktop.

Select an option

Save ennerf/31d0040799aed9a690b0a2629da141b7 to your computer and use it in GitHub Desktop.
FXML Files
<?xml version="1.0" encoding="UTF-8"?>
<!-- main.fxml -->
<StackPane fx:id="root" prefHeight="500.0" prefWidth="500.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="us.hebi.gui.ViewSwitchAppController">
<HBox alignment="CENTER" spacing="50.0">
<children>
<!-- include the other fxml files as nested components -->
<fx:include fx:id="view1" source="view1.fxml" />
<fx:include fx:id="view2" source="view2.fxml" />
</children>
</HBox>
</StackPane>
<!-- view1.fxml -->
<StackPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="demo.ViewController">
<children>
<Button fx:id="button" text="View 1 Button"/>
</children>
</StackPane>
<!-- view2.fxml -->
<StackPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="demo.ViewController">
<children>
<Button fx:id="button" text="View 2 Button"/>
</children>
</StackPane>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment