Skip to main content

How to get tree node/cell selection data?

1 reply [Last post]
rranjan08
Offline
Joined: 2007-12-17
Points: 0

How to get which cell in the tree is selected? Can I get the 'text' element of the tree cell that is selected? If not, what information exactly can be retrieved and how?

Basically, I need to have a tree in a left pane and based on which node is selected I need to draw a certain Widget in the right pane. What is the way to do that with JavaFX?

A quick answer would be very much appreciated, as we are trying out a prototype and I need to get to a solution on this by next day.

I am using NetBeans 6.0. Is that the right environment? I have tried to see the JavaFX API page https://openjfx.dev.java.net/nonav/api/index.html. But it does not have much help on this.

Thanks,
Reetesh

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dnivra
Offline
Joined: 2007-01-11
Points: 0

Add a trigger that detects when the tree cell selection changes.

[code]
trigger on TreeCell.selected = value {
if (value == true) {
println("Selected cell is {text}");
}
}
[/code]