SWT:以编程方式更改复选框值时出错
SWT: error in changing check box value programmatically
我的目的是根据通过下拉框设置的条件更改复选框的值。我被困在这个地方了。但这并没有像预期的那样工作。
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();
}
您调用了Button
的setSelected(boolean)
方法来勾选复选框。
setEnabled
调用将控件标记为启用或禁用(不可用)。
我的目的是根据通过下拉框设置的条件更改复选框的值。我被困在这个地方了。但这并没有像预期的那样工作。
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();
}
您调用了Button
的setSelected(boolean)
方法来勾选复选框。
setEnabled
调用将控件标记为启用或禁用(不可用)。