Java Reference
In-Depth Information
called the Hierarchy, and the Controller that provides event handler code for the various controls in the UI. On the
right side is the Inspector area that has subareas that allow you to manipulate Properties, Layout, and Code hookup of
the currently selected control.
Understanding the FXML File
Listing 3-1 shows the FXML file that is saved by JavaFX SceneBuilder from the UI we have created.
Listing 3-1. StageCoach.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.Group?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Text?>
<Group fx:id="rootGroup"
onMouseDragged="#mouseDraggedHandler"
onMousePressed="#mousePressedHandler"
xmlns=" http://javafx.com/javafx/8 "
xmlns:fx=" http://javafx.com/fxml/1 "
fx:controller="projavafx.stagecoach.ui.StageCoachController">
<children>
<Rectangle fx:id="blue"
arcHeight="50.0"
arcWidth="50.0"
fill="SKYBLUE"
height="350.0"
strokeType="INSIDE"
width="250.0"/>
<VBox fx:id="contentBox"
layoutX="30.0"
layoutY="20.0"
spacing="10.0">
<children>
<Text fx:id="textStageX"
strokeType="OUTSIDE"
strokeWidth="0.0"
text="x:"
textOrigin="TOP"/>
<Text fx:id="textStageY"
layoutX="10.0"
layoutY="23.0"
strokeType="OUTSIDE"
strokeWidth="0.0"
text="y:"
textOrigin="TOP"/>
 
Search WWH ::




Custom Search