Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Update ModelObject's fields when JTextField value changes without Button clicks using binding

 
Jeyaganeshan Jeyatharsini
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to update a model object's fields when user enters some value in JTextField. Say Person object's name field should be updated automatically when the user enter a value in a text field. I found it can be done with DocumentListener. But I desire to know that can it be done with binding? If so how can it be done?
 
Campbell Ritchie
Marshal
Posts: 52632
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This discussion would fit better in our GUIs forum: moving.
I suggest you go through the Java™ Tutorials about key bindings. You didn't say what sort of model you are using, but you can remind yourself about table models here.
 
Jeyaganeshan Jeyatharsini
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell Ritchie I have seen that when JTextField is changed, the value in JTable is changed due to binding. Like that,



if I put like the above, will it automatically update firstName field of the person object?

Sorry if the question is too silly..
I'm novice to binding
 
Campbell Ritchie
Marshal
Posts: 52632
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know. That is a different sort of binding from what I thought at first.
 
Knute Snortum
Sheriff
Posts: 3281
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use code tags and use proper formatting when you post code. I've added the code tags for you this time.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That AutoBinding type is not part of the standard Java API. So you should mention where it comes from.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!