Hi,
I would like to bind a JTextField with a String in such a way that an
update of JTextField content results in a modification of the String.
Actually it's no more no less than ui-model relation. I searched
around JTextField(Document) constructor, PlainDocument...
Thanks a lot.
-o
visionset - 10 May 2007 14:54 GMT
> Hi,
>
[quoted text clipped - 3 lines]
> Actually it's no more no less than ui-model relation. I searched
> around JTextField(Document) constructor, PlainDocument...
Since Strings are immutable that would be impossible.
Perhaps if you elaborate on your end goal, an alternative solution could be
suggested.
You probably just need to add a DocumentListener to the JTextFields
Document.

Signature
Mike W
~kurt - 10 May 2007 15:01 GMT
> I would like to bind a JTextField with a String in such a way that an
> update of JTextField content results in a modification of the String.
>
> Actually it's no more no less than ui-model relation. I searched
> around JTextField(Document) constructor, PlainDocument...
Would overriding the JTextField's createDefaultModel() method to
return your own version of a PlainDocument object work? The PlainDocument
could be initialized with a class that contains whatever needs to be
modified (say, what the String points to).
- Kurt