2. JavaFX Script Basics
This chapter begins our discussion of the JavaFX Script programming language by looking at the structure of a JavaFX source file. All JavaFX code is placed in source files, which, by convention, use the naming suffix .fx
and are converted by the JavaFX compiler into a set of equivalent class files for execution on the Java Virtual Machine. In this chapter, you see how to structure a JavaFX source file, how to import and use code in existing Java and JavaFX classes, and how a JavaFX script is executed.
Source File Structure
A JavaFX source file is structured like this:
• Optional package
statement
• Optional import
statements
• Optional JavaFX statements
Here is a simple JavaFX application that prints a random number: ...
Get JavaFX™ Developer’s Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.