Greetings,
I am busy teaching myself FXML. I'm doing this by following
this example.
It's a simple text editor. However, in the tutorial everything is Java code.
I myself am using FXML to seperate the view of the logic.
I currently face the following challenge:
I have defined an TextArea in my FXML like so:
<TextArea id="taTextArea" fx:id="taContent" wrapText="true" />
Usually you add action listeners using onAction="#actionName"
What I want to know is, how can I do something similar for text changes. So I can detect wether a save is needed, modify the status bar label etc.(isDirty property or something alike)
I want to avoid having to attach the TextArea to a change listener in the init method of the controller(implementing Initializable).
I'm mainly worried that if this isn't possible, what would be the point of being able to define events in FXML at all.
Also.. when I complete this application, I will write a blog about it. With the lacking FXML documentation, I think itll be helpfull to other newbies. So I want my code to be as clean as possible.
I have also posted it on stack overflow:
[link to stackoverflow|http://stackoverflow.com/questions/11716977/javafx-2-define-onchange-listener-in-fxml]
Edited by: 949712 on 30-jul-2012 1:30