I am a newbie to Kotlin and I have an error I hope someone can resolve for me.
To find my way around Kotlin I have started a project to develop a builder for JavaFX.
Part of that involves developing an MVC framework. The basic architecture is built around the following
abstract classes that establish the framework:
abstract class MVCAB(val name: String, val par: MVCAB? = null) {
abstract class ModelAB {
//...
} // ModelAB
abstract class ViewAB(val model: ModelAB) {
//...
} // ViewAB
abstract class ControllerAB(val model: ModelAB, val view: ViewAB) {
//...
} // ControllerAB
// ---------- properties ----------------------------------
//…
public abstract val model: ModelAB
public abstract val view: ViewAB
public abstract val controller: ControllerAB
}
A concrete example is then defined in an application:
public class ExampleModel : MVCAB.ModelAB() {
}
class ExampleView(model: MVCAB.ModelAB) : MVCAB.ViewAB(model) {
// ---------- properties ------------------------------
val stage = builder?.stage(arrayList("title" to "DemoFX", "x" to 100, "y" to 100, "width" to 400, "height" to 300)) {
scene(arrayList(“someting” to “something”)) {
flowPane(arrayList(“hgap” to 5)) {
text(arrayList(“text” to “Application widgets go here”))
}
}
}
}
class ExampleController(model: MVCAB.ModelAB, view: MVCAB.ViewAB) : MVCAB.ControllerAB(model, view) {
}
override public val model: MVCAB.ModelAB = ExampleModel() // LINE 40
override public val view: MVCAB.ViewAB = ExampleView(model)
override public val controller: MVCAB.ControllerAB = ExampleController(model, view)
}
And run with:
fun startup(args: Array<String>) {
Application.launch(this.javaClass)
}
override fun start(p0: Stage?): Unit {
val mvc: ExampleMVC = ExampleMVC()
//mvc.view.stage?.show()
}
}
fun main(args: Array<String>) {
println(“Hello ExampleFX”)
val ex = ExampleFX() // LINE 25
ex.startup(args)
println(“Bye ExampleFX”)
}
I get the following execution error:
Process finished with exit code 1
Any suggestions? Have I made an error in the code? Is there a bug?
Ta
Ken