我是tornadoFX的新手,我不知道如何設置PrimaryStage或Scene屬性,如場景高度或寬度或PrimaryStage模態。 請幫幫我。在TornadoFX中設置PrimaryStage或Scene屬性的方法
UPDATE
我想設置場景的高度和寬度,請看下面的例子:
dependencies {
compile 'no.tornado:tornadofx:1.5.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.3"
}
import javafx.scene.control.Label
import javafx.scene.layout.VBox
import tornadofx.App
import tornadofx.FX
import tornadofx.View
class Main : App() {
override val primaryView = MyView::class
init {
// this two lines have error (Val cannot be reassigned.)
FX.primaryStage.scene.height = 600.0
FX.primaryStage.scene.width = 800.0
// or this line causes this exception (java.lang.NoSuchMethodException)
FX.primaryStage.isResizable = false
}
}
class MyView : View() {
override val root = VBox()
init {
root.children.add(Label("My label"))
}
}
快速提示:標籤與「tornadofx」和一些TornadoFX團隊成員將立即通知你的問題你的問題:) –
@EdvinSyse謝謝你的回答,你是對的,但我無法創建「tornadofx」標籤(我找不到這個標籤,並且因爲我的聲望而無法創建新標籤)。 – mojtab23
啊,看起來我們有一個標籤,但它從來沒有被使用,所以它可能被刪除。我會看到關於恢復。謝謝:) –