开发者

Swing Databinding for multiple JComponents

开发者 https://www.devze.com 2023-03-09 05:41 出处:网络
I\'m pretty new to JAVA. I\'m having a domain-model (containing the data) and I have a viewer-model (providing the GUI). Now I have several JLabels (or any other JComponents) on different windows, bei

I'm pretty new to JAVA. I'm having a domain-model (containing the data) and I have a viewer-model (providing the GUI). Now I have several JLabels (or any other JComponents) on different windows, being bound to the same data-source in the domain-model.

I tried using beansbinding, but unfortunatly beansbind开发者_开发技巧ing seems not to support the binding of several widgets on a single source - only one widget is updated, the others are left untouched.

JGoodies is not possible for me, due to license questions.

Does anyone know another (free) Databinding-Project for SWING?

Thanks in advance Joan


Have a look to the Client Editor sample application provided with NetBeans (New Project -> Samples / Java / Client Editor)

  1. Open the main frame: ClientEditor.java
  2. Add a label somewhere (in the corner bottom left for example)
  3. Change its Binding (in Properties window) and use the same "formula" as the usernameLabel (at the right of "Client Info:") which is: Form[${client.firstName} ${client.surname}]

Result:

Swing Databinding for multiple JComponents

0

精彩评论

暂无评论...
验证码 换一张
取 消