2017-09-26 67 views

回答

3

的類型安全的建設者您創建的節點的情況下運行,這樣你就可以創建自定義節點,要麼做children.add(myCustomComponent)甚至this += myCustomComponentadd(myCustomComponent)建築工地內。他們都是這樣做的 - 將自定義組件添加到您稱爲add的節點的子節點列表中。

hbox { 
    label("Builders + custom components") 
    val myCustomComponent = SomeCustomComponent() 
    // Add to HBox 
    add(myCustomComponent) 
} 

如果你想利用整合一步,你可以自定義組件添加助劑的功能,所以你可以寫hbox { myCustomComponent { ... } }。有關如何添加構建器的更多信息,請查看源代碼。

+0

謝謝你的快速回答。你做得很好,並且總是給別人幫助,這是令人印象深刻的。 – thlinde

+0

感謝您的客氣話。我們有很多人在我們的社區幫助這裏和Slack,所以它應該總是很容易得到TornadoFX相關問題的答案:) –