本文整理汇总了Java中org.eclipse.swt.widgets.Button.pack方法的典型用法代码示例。如果您正苦于以下问题:Java Button.pack方法的具体用法?Java Button.pack怎么用?Java Button.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.Button
的用法示例。
在下文中一共展示了Button.pack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCopyButton
import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
/**
* Creates the copy button
* @param buttonComposite
*/
private void createCopyButton(Composite buttonComposite){
Button copyButton = new Button(buttonComposite, SWT.PUSH);
copyButton.setImage(ImagePathConstant.ENABLE_COPY_ICON.getImageFromRegistry());
copyButton.setToolTipText(COPY_BUTTON_TOOL_TIP);
copyButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (StringUtils.isNotBlank(styledText.getSelectionText())) {
styledText.copy();
} else {
styledText.selectAll();
styledText.copy();
styledText.setSelection(0);
}
}
});
copyButton.pack();
}
示例2: createWrapButton
import org.eclipse.swt.widgets.Button; //导入方法依赖的package包/类
/**
* Creates the word wrap button
* @param buttonComposite
*/
private void createWrapButton(Composite buttonComposite)
{
final Button btnCheckButton = new Button(buttonComposite, SWT.CHECK);
btnCheckButton.setText("Wrap Text");
btnCheckButton.pack();
btnCheckButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
styledText.setWordWrap(btnCheckButton.getSelection());
}
});
}
示例3: 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;
}