• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Model Binding  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know the mechanism for binding a model object to, say, a JTextField so that as I type the java bean gets updated. What I am having a hard time tracking down is how to create the binding so that if I manually populate the domain object elsewhere the JTextField is aware of that and its view gets updated.

Any links, tips, pointers, etc?

Thanks.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using a specific binding framework or developing your own?

A JavaBean PropertyChangeListener will tell you when a bean's value changes - but I'd think an existing binding framework would do this by default?

Perhaps there are also threading issues affecting this, though... i.e. use SwingUtilities.invokeLater()?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on my own at the moment. Thanks, I'll take a peak at PropertyChangeListener. I've used it before but been a while.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!