JavaBean wrapping with JavaFX Properties
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to use JavaFX properties for UI binding, but I don't want them in my model classes (see Using javafx.beans properties in model classes ). My model classes have getters and setters, and I want to create properties based on those. For example, assuming an instance bean with methods String getName() and setName(String name) , I would write SimpleStringProperty property = new SimpleStringProperty(bean, "name") expecting that property.set("Foobar") would trigger a call to bean.setName . But this doesn't seem to work. What am I missing? 回答1