Sure.  Instead of saying.. listen to this text field and whenever it
changes update this variable, and listen to this variable and whenever
it changes update the text field, you bind the two together and then
forget about it.

TextField {
    text: bind varName
}

At least that's in the original dead language.  I don't know how it's
done in the API version of JavaFX, but rather than wait I did
something similar myself, though without the magic[1]:

https://github.com/rickyclarkson/fj-swing

I should note that I am not using fj-swing, though I am using a couple
of private implementations of the same concept.

[1] The magic is a cool way of implementing this stuff so that each
evaluation configures a dependency tree.  Consider some psuedocode.

bind x = 5
bind y = 10
bind z = x >= 5 ? y * 2 : 3
bind textfield.text = String.valueOf(z)

That says that x is bound to 5, y is bound to 10, and z is bound to y
* 2 if x is >= 5, 3 otherwise.  Now consider:

rebind x = 4

Logically that should result in the text field changing, which means
you need to be able to know that z depends on x.  Well, you can,
because you can record what gets evaluated while binding z.

Note that in this reevaluation of z, y is removed from the dependency
tree, as unless x changes again the value of y is irrelevant.

--
Skype: ricky_clarkson
UK phone (forwards to Skype): 0161 408 5260



2011/5/31 Cédric Beust ♔ <[email protected]>:
> On Tue, May 31, 2011 at 10:35 AM, Ricky Clarkson <[email protected]>
> wrote:
>>
>> I particularly like the event dispatching, it looks like it wouldn't
>> lead to the same mess raw Swing often does.
>
> Can you be more specific on what you like about it?
> --
> Cédric
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to