我的目的是更改复选框的值并根据通过下拉框设置的条件。我被困在这个地方。但这并没有像预期的那样发挥作用。
public void notifyChanged(IPropertyEditor otherEditor) {
ConnectionType changedConnectionType = getConnectionType(otherEditor);
if (!ConnectionType.UNDEFINED.equals(changedConnectionType)) {
connectionType = changedConnectionType;
updateChange(false);
}
if (button != null && !ConnectionType.UNDEFINED.equals(connectionType)) {
button.setEnabled(canEnable(connectionType));
updateChange(true);
}
}
private void updateChange(boolean selected){
this.selected=selected;
setChanged();
notifyObservers();
}
答案 0 :(得分:1)
您调用setSelected(boolean)
Button
方法选中复选框。
setEnabled
调用将控件标记为启用或禁用(不可用)。