Skip to content

Instantly share code, notes, and snippets.

@shemnon
Created September 4, 2012 14:07
Show Gist options
  • Save shemnon/3621462 to your computer and use it in GitHub Desktop.
Save shemnon/3621462 to your computer and use it in GitHub Desktop.
GroovyFX 3.0 FXML integration
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
id="AnchorPane"
prefHeight="150.0" prefWidth="320.0" >
<children>
<Button id="buttonCSSID"
layoutX="40.0" layoutY="65.0"
prefWidth="100.0"
text="Click Me!" />
<Label id="labelCSSID"
alignment="CENTER" contentDisplay="CENTER"
layoutX="40.0" layoutY="100.0"
minHeight="16.0" minWidth="69.0"
prefHeight="16.0" prefWidth="100.0" />
<Button fx:id="buttonFXID"
layoutX="180.0" layoutY="65.0"
prefWidth="100.0" text="Click Me!" />
<Label fx:id="labelFXID"
alignment="CENTER" contentDisplay="CENTER"
layoutX="180.0" layoutY="100.0"
minHeight="16.0" minWidth="69.0"
prefHeight="16.0" prefWidth="100.0" />
</children>
</AnchorPane>
fxml resource("/FXMLDemoInline.fxml"), {
buttonCSSID.onAction {
labelCSSID.text = "Clicked - CSS";
}
buttonFXID.onAction {
labelFXID.text = "Clicked - FXML";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment