FXML (JavaFX 25)
Description: declaration: module: javafx.fxml, package: javafx.fxml, annotation type: FXML

# Annotation Interface FXML

@Retention(RUNTIME) @Target({FIELD,METHOD}) public @interface FXML
Annotation that tags a field or method as accessible to markup.

Deploying an Application as a Module

If the object being annotated is in a named module then it must be reflectively accessible to the `javafx.fxml` module. Otherwise, the `FXMLLoader` will fail with an `InaccessibleObjectException` when it attempts to modify the annotated element. An object is reflectively accessible if the module containing that object `opens` the containing package to at least the `javafx.fxml` module.

For example, if the object being annotated is in the `com.foo` package in the `foo.app` module, the `module-info.java` might look like this:

    module foo.app {
        opens com.foo to javafx.fxml;
    }

Alternatively, an object is reflectively accessible if it is declared as a public member, is in a public class, and the module containing that class `exports` the containing package unconditionally.

Since:
  JavaFX 2.0