和TextCellEditor不同, CheckboxCellEditor不会创建Control.
/**
* Note that this implementation simply fakes it and does does not create
* any new controls.
*/
创建CheckboxCellEditor只需
new CheckboxCellEditor(null, SWT.CHECK)
CheckboxCellEditor通过LableProvider来显示值被改变。
//根据element的值返回不同的图片。
ITableLabelProvider.getColumnImage(Object element, int columnIndex)
点击cell时, CheckboxCellEditor会将值取反。
public void activate() {
value = !value;
fireApplyEditorValue();
}
CheckboxCellEditor详解
本文介绍了CheckboxCellEditor的基本用法及特点。与TextCellEditor不同,CheckboxCellEditor不创建新的控件,仅需一行代码即可创建实例。通过LabelProvider显示值的变化,并在单元格点击时自动取反当前值。
2421

被折叠的 条评论
为什么被折叠?



