edvin / tornadofx

Lightweight JavaFX Framework for Kotlin
Apache License 2.0
3.68k stars 272 forks source link

Can't call the Stage.init?() methods #164

Closed luleyleo closed 8 years ago

luleyleo commented 8 years ago

This

class MyApp: App(MainView::class, Styles::class) {
    override fun start(stage: Stage) {
        super.start(stage)
        stage.initStyle(StageStyle.UNDECORATED)
    }
}

causes this exception:

Exception in Application start method
Aug 26, 2016 12:23:46 PM tornadofx.DefaultErrorHandler uncaughtException
SCHWERWIEGEND: Uncaught error
java.lang.NoSuchMethodException: de.leopoldluley.exacalc.app.MyApp.main([Ljava.lang.String;)
    at java.lang.Class.getMethod(Class.java:1786)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:126)

How can I make the Stage undecorated / modal / a child stage?

edvin commented 8 years ago

Move stage.initStyle(StageStyle.UNDECORATED) before super.start(stage). You can't change the stage style after the stage has been shown, so this makes sure you do it before :)