Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Attach JTextField with String property

Thread view: 
oziris - 10 May 2007 13:55 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.