I'm attempting to create a simple text editor in JavaFX but have stumbled upon a problem. My code that is supposed to save the current text can't get that text from the TextArea
in my Scene
. When I call getText()
on the TextArea
I just get back an empty string, even though something is written in there.
The TextArea
is created in my Main
class and assigned to a static
field of a small helper-class called Global
, so that it can be accessed in my other class ApplicationMenu
where I call getText()
.
Check out my source code at https://github.com/axelkennedal/Kode
Notes:
getText()
works as expected from inside myMain
class- I tested using a
TextArea
directly without encapsulating it inTextEditor
and this works as expected when callinggetText()
on it fromApplicationMenu