Java Reference
In-Depth Information
First, let's take a look at the FXML that's used to construct the layout. The follow-
ing lines of markup construct a scene graph that contains a Pane enclosing a Tex-
tFlow . The TextFlow contains a series of Text nodes, each of which has different
styles applied. The following listing contains the sources for textfonts.fxml .
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>
<Scene width="200" height="75" fill="white"
xmlns:fx=" http://javafx.com/fxml ">
<stylesheets>
<URL value="@textfonts.css"/>
</stylesheets>
<Pane fx:id="pane">
<TextFlow styleClass="mainmessage">
<Text styleClass="span1">Hello </Text>
<Text text=" "/>
<Text styleClass="span2, large">Java</Text>
<Text styleClass="span3, slant">FX</Text>
<Text text=" "/>
<Text styleClass="cool">8</Text>
</TextFlow>
</Pane>
</Scene>
Within the FXML, a cascading style sheet named textfonts.css is imported.
The following listing contains the styles, which reside in textfonts.css .
.mainmessage {
-fx-font-family: "Helvetica";
Search WWH ::




Custom Search