fun main(args: Array) { launch(args) } class RenameTest : App(FirstView::class) { init { reloadViewsOnFocus() } } class FirstView : View() { override val root = borderpane { //this is the value I want to use a ViewModel to update //I need to bind it (maybe?) to the value of the textfield before hitting "save" in RenameTestFragment val changeableName = SimpleStringProperty("Changeable Name") top { add(TestItem(changeableName).squeeze) } } override fun onDock() { super.onDock() primaryStage.minWidth = 800.0 primaryStage.minHeight = 600.0 primaryStage.width = 1024.0 primaryStage.height = 768.0 } } class TestItem(name: SimpleStringProperty) { val squeeze = SqueezeBox().apply { fold(name.value, icon = MyMenuButton(name)) { graphicTextGap = 20.0 contentDisplay = ContentDisplay.RIGHT alignment = Pos.CENTER_RIGHT vbox { text("inside content") } } } } class MyMenuButton(name: SimpleStringProperty) : MenuButton() { init { item("Rename") { action { RenameFragmentTest(name).openModal(stageStyle = StageStyle.UTILITY, escapeClosesWindow = true) } } } } class RenameFragmentTest(name: SimpleStringProperty) : Fragment("Rename") { override val root = vbox { val renameTextField = textfield(name.value) style { padding = box(12.px) } borderpane { left { button("cancel") { action { close() } } } right { button("save") { action { //commit something here to update the changeableName property to renameTextField.text close() } } } } } }