本文整理匯總了Java中org.eclipse.swt.widgets.Button.getSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.getSize方法的具體用法?Java Button.getSize怎麽用?Java Button.getSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Button
的用法示例。
在下文中一共展示了Button.getSize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addAclTableItem
import org.eclipse.swt.widgets.Button; //導入方法依賴的package包/類
public TableItem addAclTableItem(ACL acl) {
final Table table = getTable();
final TableItem item = new TableItem(table, SWT.NONE);
item.setData("ACL", acl);
Id id = acl.getId();
int aclPerms = acl.getPerms();
boolean hasAll = ((aclPerms & ZooDefs.Perms.ALL) == ZooDefs.Perms.ALL);
item.setText(0, id.getScheme());
item.setText(1, id.getId());
for (final int perm : PERMS) {
final int permColumnIndex = getPermissionColumnIndex(perm);
TableEditor permCheckBoxTableEditor = new TableEditor(table);
setItemPermTableEditor(item, perm, permCheckBoxTableEditor);
final Button permCheckBox = new Button(table, SWT.CHECK);
boolean hasPerm = ((aclPerms & perm) == perm);
permCheckBox.setSelection(hasPerm);
permCheckBox.setEnabled(!hasAll || (hasAll && perm == ZooDefs.Perms.ALL));
permCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (perm == ZooDefs.Perms.ALL) {
for (int subPerm : PERMS) {
if (subPerm == ZooDefs.Perms.ALL) {
continue;
}
Button subPermCheckBox = getItemPermCheckBox(item, subPerm);
boolean allIsSelected = permCheckBox.getSelection();
if (allIsSelected) {
subPermCheckBox.setSelection(true);
}
subPermCheckBox.setEnabled(!allIsSelected);
}
}
fireOrchestrationChange();
}
});
permCheckBox.pack();
permCheckBoxTableEditor.minimumWidth = permCheckBox.getSize().x;
permCheckBoxTableEditor.horizontalAlignment = SWT.CENTER;
permCheckBoxTableEditor.setEditor(permCheckBox, item, permColumnIndex);
}
return item;
}