My goal is to have an MVC pattern in a simulation application where the controller knows there is a view (and interacts with it using an interface) but doesn't know how it is implemented:
object Controller extends App {
View.initView()
...
}
object View {
stage: Stage = ...
def initView: Unit = {
...
}
}
However I only managed to do so having the entry point of the program to extend scalafx.application.JFXApp, javafx.application.Application (example below) or swing.SimpleSwingApplication which forces the controller to know how the view is implemented. Is there any simple workaround?
def main(args: Array[String]): Unit = {
Application.launch(classOf[SimulatorApp])
}
class SimulatorApp extends Application {
override def start(stage: Stage): Unit = {
View.initView(stage)
}
}