Annotation Interface Controller


@Target(TYPE) @Retention(RUNTIME) public @interface Controller
Annotation used to mark controllers.

Controllers are used to control inputs and connect the view with the model.

For controllers which should be reusable inside other controllers ("subcomponents"), see Component. It is recommended to use Component instead of Controller as it is more flexible.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The view that should be rendered when displaying the controller.
  • Element Details

    • view

      String view
      The view that should be rendered when displaying the controller. This can either be a path to an FXML file or a method that returns a Node.

      If nothing is specified the default naming scheme for an FXML file will be used (ExampleController --> Example.fxml).

      Example: '#myMethod' will call the method myMethod() in the controller and use the returned Parent (throwing an exception if the method does not exist or is invalid).

      Example: 'path/to/myView.fxml' will load the FXML file myView.fxml and use its root node as the view.

      Returns:
      The String specifying the view.
      Default:
      ""