gpt4 book ai didi

data-binding - eclipse rcp : how to bind a checkbox

转载 作者:行者123 更新时间:2023-12-01 13:59:37 26 4
gpt4 key购买 nike

模型类有一个可见的属性,它的字符串可以有两个值“1”表示是,“0”表示否,我如何将它绑定(bind)到复选框?

最佳答案

我建议使用 JFace 数据绑定(bind)框架:参见 Vogella's tutorial on it .

JFace Data Binding is a framework which connects properties of objects.
For example you would bind the property "firstName" of a "Person"" object to a text field in the UI. This binding would synchronize changes in the model and the UI, e.g. if the user changes the name in the UI the model would automatically be updated

data binding

与:

public class Person implements PropertyChangeListener {
[...]
private String gender;

和:

DataBindingContext ctx = new DataBindingContext();
widgetValue = WidgetProperties.selection().observe(marriedButton);
modelValue = BeanProperties.value(Person.class, "married").observe(person);
ctx.bindValue(widgetValue, modelValue);

关于data-binding - eclipse rcp : how to bind a checkbox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7466113/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com