當前位置: 首頁>>代碼示例>>Java>>正文


Java Button.pack方法代碼示例

本文整理匯總了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();
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:25,代碼來源:TransformViewDataDialog.java

示例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());
		}
    	
	});
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:TransformViewDataDialog.java

示例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;
    }
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:60,代碼來源:ZnodeAclComposite.java


注:本文中的org.eclipse.swt.widgets.Button.pack方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。