Skip to content

Instantly share code, notes, and snippets.

@ennerf
Last active May 28, 2022 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ennerf/133fde133f9a8d5f32e9aff18df4b25e to your computer and use it in GitHub Desktop.
Save ennerf/133fde133f9a8d5f32e9aff18df4b25e to your computer and use it in GitHub Desktop.
View 2 FXML bindigns
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<StackPane xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="us.hebi.gui.ViewController">
<children>
<VBox>
<children>
<!-- binds text to the ViewController::getCfg::unitLabelProperty -->
<Text text="${controller.cfg.unitLabel}"/>
<!-- binds visibility to ViewController:getCfg::debugEnabledProperty -->
<HBox prefHeight="100.0" visible="${controller.cfg.debugEnabled}"
managed="${controller.cfg.debugEnabled}">
<children>
<Button mnemonicParsing="false" text="I'm only here during debugging!"/>
</children>
</HBox>
<Button fx:id="button" text="View 2 Button"/>
</children>
</VBox>
</children>
</StackPane>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment