我想知道,是否可以像在 C# 中那样在 Java 中进行数据绑定(bind)?用 Google 搜索了很多,但没有找到适合我的答案。
例如,我想将集合绑定(bind)到 Jtable,并希望在我添加、删除或更改集合中的某些元素时更新 JTable。
提前致谢!
最佳答案
是的,有 Java Beans 绑定(bind)。
看看:
至于你的JTable Example,有observable Collections,例子:
ObservableList<Employee> employees =
ObservableCollections.observableList(
new ArrayList<Employee>());
摘自一篇文章Beans Binding: A Java Data-Binding Solution with a Serious Problem .
关于java数据绑定(bind)到gui,就像在c#中一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10460174/