Created
November 12, 2012 14:05
-
-
Save prassee/4059577 to your computer and use it in GitHub Desktop.
Listen to selection on TreeItem in TreeView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val controlsView = new TreeView[String]() { | |
hgrow = javafx.scene.layout.Priority.ALWAYS | |
minWidth = 200 | |
editable = true | |
root = rootTreeItem | |
id = "page-tree" | |
} | |
controlsView.getSelectionModel.setSelectionMode(SelectionMode.SINGLE) | |
controlsView.getSelectionModel.selectedItemProperty.addListener(new ChangeListener[Any] { | |
def changed(observable: ObservableValue[_], oldValue: Any, newValue: Any) { | |
val selItem = newValue.asInstanceOf[javafx.scene.control.TreeItem[String]] | |
println("clicked " + selItem.getValue()) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment