本文整理匯總了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;
}