ControllerFX

org.scalafx.extras.mvcfx.ControllerFX
trait ControllerFX

The ControllerFX creates connection of the FXML to Scala code and underlying ModelFX for the application logic.

Constructor argument names correspond to controls defined in FXML and the model. The constructor is used by ScalaFXML macro to automatically expose FXML controls in Scala code of the view class.

See more details in the `org.scalafx.extras.mvcfx` documentation.

Example:

import org.scalafx.extras.mvcfx.ControllerFX

import scalafx.Includes.*
import scalafx.scene.control.Button

import javafx.scene.control as jfxsc
import javafx.fxml as jfxf

class StopWatchController(model: StopWatchModel) extends ControllerFX:

 @jfxf.FXML
 private var startButton: jfxsc.Button = _

 override def initialize(): Unit =
   startButton.disable <== model.running
   startButton.onAction = () => model.onStart()

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def initialize(): Unit

Performs custom initialization of the this controller. It is called by JavaFX runtime after associated FXML from was loaded and controls instantiated.

Performs custom initialization of the this controller. It is called by JavaFX runtime after associated FXML from was loaded and controls instantiated.

Attributes