Skip to content

Instantly share code, notes, and snippets.

@pethaniakshay
pethaniakshay / FXML2.fxml
Created June 8, 2017 19:43
Switching between Scenes (Screens) in JavaFx using the FXML
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane id="AnchorPane" prefHeight="237.0" prefWidth="448.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.60" fx:controller="FXMLDocumentController">
<children>
<Button fx:id="btn2" layoutX="159.0" layoutY="126.0" mnemonicParsing="false" onAction="#handleButtonAction" text="Click to go to scene 1" />
<Label layoutX="179.0" layoutY="71.0" text="You re in scene 2" />