I have a lot of TextArea
nodes in a Scene
.
Is it possible for me to figure out which TextArea
is selected (has the caret in it)?
I would like to be able to select the node and set it to a Node
variable.
Actually there is no need to set a focused node variable, because Scene
already contains a focusOwnerProperty
.
So you could use it e.g. like:
if (scene.focusOwnerProperty().get() instanceof TextArea) {
TextArea focusedTextArea = (TextArea) scene.focusOwnerProperty().get();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With