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 Objecttrait Matchableclass Any
- Known subtypes
-
class ProgressStatusController
Members list
In this article