O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

There is no XSD defining the schema for the FXML document. So, to know the tags to be used, they follow a simple naming convention. The Java class name of the component is also the name of the XML tag. For example, the XML tag for the javafx.scene.layout.GridPane layout is <GridPane>, for javafx.scene.control.TextField, it is <TextField>, and for javafx.scene.control.DatePicker, it is <DatePicker>:

Pane pane = (Pane)loader.load(getClass()
    .getModule()
    .getResourceAsStream("com/packt/fxml_age_calc_gui.fxml")
 );

The preceding line of code makes use of an instance of javafx.fxml.FXMLLoader to read the FXML file and get the Java representation of the UI components. FXMLLoader uses an event-based SAX parser to parse the FXML file. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required