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


Java Combo.select方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.Combo.select方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.select方法的具體用法?Java Combo.select怎麽用?Java Combo.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.Combo的用法示例。


在下文中一共展示了Combo.select方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDialogArea

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parentShell) {
  Composite parent = (Composite) super.createDialogArea(parentShell);
  Composite c = new Composite(parent, SWT.NONE);

  c.setLayout(new GridLayout(2, false));

  Label l = new Label(c, SWT.NONE);
  l.setText("Select device: ");

  final Combo combo = new Combo(c, SWT.BORDER | SWT.READ_ONLY);
  combo.setItems(mDeviceNames);
  int defaultSelection =
      sSelectedDeviceIndex < mDevices.size() ? sSelectedDeviceIndex : 0;
  combo.select(defaultSelection);
  sSelectedDeviceIndex = defaultSelection;

  combo.addSelectionListener(new SelectionAdapter() {
    @Override
    public void widgetSelected(SelectionEvent arg0) {
      sSelectedDeviceIndex = combo.getSelectionIndex();
    }
  });

  return parent;
}
 
開發者ID:DroidTesting,項目名稱:android-uiautomatorviewer,代碼行數:27,代碼來源:ScreenshotAction.java

示例2: createAssertionCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createAssertionCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    for ( final Assertion assertion : Assertion.values () )
    {
        c.add ( assertion.toString () );
    }
    c.select ( 0 );
    c.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            AssertionComposite.this.orCondition.updateFilter ();
        }
    } );
    final RowData rowData = new RowData ();
    rowData.width = 75;
    c.setLayoutData ( rowData );
    return c;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:FilterAdvancedComposite.java

示例3: addCombovalues

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void addCombovalues(Combo combo, String paramType) {
	if(!PrimitiveType.isPrimitiveSig(paramType)) {
		String sel = combo.getText();
		combo.removeAll();
		combo.add("null");
		IType owner = (IType) method.getParent();
		try {
			IField[] fields = owner.getFields();
			for(IField f : fields)
				if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
					combo.add(f.getElementName());


		} catch (JavaModelException e1) {
			e1.printStackTrace();
		}
		if(sel.isEmpty())
			combo.select(0);
		else
			combo.setText(sel);
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:23,代碼來源:StaticInvocationWidget.java

示例4: populateCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Populates the combo with the specified values. The specified initial
 * value is set as the initial selection it it appears in the array of
 * values, otherwise the first value is selected.
 *
 * @param combo
 *        The combo to populate.
 *
 * @param values
 *        The values for the combo drop down.
 *
 * @param initialValue
 *        The value which should be the initial selected value.
 *
 * @return The index of the selected item.
 */
public static int populateCombo(final Combo combo, final String[] values, final String initialValue) {
    Check.notNull(combo, "combo"); //$NON-NLS-1$
    Check.notNull(values, "values"); //$NON-NLS-1$

    if (values.length == 0) {
        return -1;
    }

    int selectedIndex = 0;
    for (int i = 0; i < values.length; i++) {
        final String value = values[i];
        if (value.equals(initialValue)) {
            selectedIndex = i;
        }
        combo.add(value);
    }

    combo.select(selectedIndex);
    setVisibleItemCount(combo);
    return selectedIndex;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:38,代碼來源:ComboHelper.java

示例5: addInverseChooser

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Creates the additional controls of the page.
 * @param parent parent component
 */
private void addInverseChooser(Composite parent) {
    
    Label label = new Label(parent, SWT.LEFT);
    label.setText(TexlipsePlugin.getResourceString("preferenceViewerInverseLabel"));
    label.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
    label.setLayoutData(new GridData());
    
    String[] list = new String[] {
            TexlipsePlugin.getResourceString("preferenceViewerInverseSearchNo"),
            TexlipsePlugin.getResourceString("preferenceViewerInverseSearchRun"),
            TexlipsePlugin.getResourceString("preferenceViewerInverseSearchStd")
    };
    
    // find out which option to choose by default
    int index = inverseSearchValues.length - 1;
    for (; index > 0 && !inverseSearchValues[index].equals(registry.getInverse()); index--) {}
    
    
    inverseChooser = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    inverseChooser.setLayoutData(new GridData());
    inverseChooser.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
    inverseChooser.setItems(list);
    inverseChooser.select(index);
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:29,代碼來源:ViewerConfigDialog.java

示例6: createDialogArea

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(2, false));
	
	label = new Label(container, 0);
	label.setText(labelTxt);
	
	combo = new Combo(container, SWT.READ_ONLY | SWT.DROP_DOWN);
	combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	combo.addModifyListener(new ModifyListener() {
		@Override public void modifyText(ModifyEvent e) {
			updateVals();
		}
	});
	combo.setItems(items);
	combo.select(0);
	
	updateVals();
	
	container.pack();

	return container;
}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:29,代碼來源:ComboInputDialog.java

示例7: createAttributeCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createAttributeCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    c.add ( "sourceTimestamp" ); //$NON-NLS-1$
    c.add ( "entryTimestamp" ); //$NON-NLS-1$
    for ( final Event.Fields field : Event.Fields.values () )
    {
        c.add ( field.getName () );
    }
    c.add ( Messages.custom_field );
    c.select ( 0 );
    return c;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:14,代碼來源:FilterAdvancedComposite.java

示例8: createTypeCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createTypeCombo ()
{
    final Combo c = new Combo ( this, SWT.NONE );
    for ( final Type type : Type.values () )
    {
        c.add ( type.name () );
    }
    c.select ( 0 );
    return c;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:11,代碼來源:FilterAdvancedComposite.java

示例9: CreateCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Create Combo Widget
 * @param control
 * @param widgetName
 * @return
 */
public Widget CreateCombo(Composite control, String[] widgetName){
	Combo combo = new Combo(control, SWT.READ_ONLY);
	combo.setItems(widgetName);
	combo.select(0);
	GridData gd_partitionKeyButton = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
	gd_partitionKeyButton.horizontalIndent = 10;
	combo.setLayoutData(gd_partitionKeyButton);
	
	return combo;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:FTPWidgetUtility.java

示例10: comboWidget

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public Combo comboWidget(Composite parent, int style, int[] bounds,
		String[] items, int selectionIndex) {
	Combo comboBox = new Combo(parent, style);
	comboBox.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
	comboBox.setItems(items);
	comboBox.select(selectionIndex);

	return comboBox;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:10,代碼來源:ELTSWTWidgets.java

示例11: createControl

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void createControl(Composite parent) {
	super.createControl(parent);
	Composite composite = (Composite) getControl();
	Group group = new Group(composite, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	group.setLayout(layout);
	group.setText("設置");
	group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

	Label label = new Label(group, SWT.NULL);
	label.setText("數據庫方言:");
	final Combo combo = new Combo(group, SWT.READ_ONLY);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	combo.setLayoutData(gd);
	DbType[] values = DbType.values();
	for (DbType type : values) {
		combo.add(type.name());
	}
	combo.select(0);
	currentDbType = combo.getText();
	setFileName("NewFile" + DEFAULT_EXTENSION);
	combo.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			currentDbType = combo.getText();
		}
	});
	setPageComplete(validatePage());
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:30,代碼來源:DbToolCreationWizardPage.java

示例12: createDecisionCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
 * Creates a new combo box, initilizes the enty values, and configures
 * it with a listener capable of updating the right entry in our
 * map of item->decision.
 */
private Combo createDecisionCombo(Composite parent, Task item) {
  Combo combo = new Combo(parent, SWT.READ_ONLY);
  combo.add(YES);
  combo.add(NO);
  combo.add(NEVER);
  combo.select(0);

  combo.addSelectionListener(new ComboListener(item));
  return combo;
}
 
開發者ID:alfsch,項目名稱:workspacemechanic,代碼行數:16,代碼來源:MechanicDialog.java

示例13: populateTreeOptionsCombo

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void populateTreeOptionsCombo(final Combo combo, final String initialValue) {
    int selectedItemIndex = 0;
    final ArrayList list = new ArrayList();
    mapTreeDisplayNameToReferenceName = new HashMap();

    final WorkItemLinkTypeCollection linkTypes = query.getWorkItemClient().getLinkTypes();
    final WorkItemLinkTypeEndCollection endTypes = linkTypes.getLinkTypeEnds();

    for (final Iterator it = endTypes.iterator(); it.hasNext();) {
        final WorkItemLinkTypeEnd end = (WorkItemLinkTypeEnd) it.next();
        if (end.getLinkType().getLinkTopology() == Topology.TREE && end.isForwardLink()) {
            final String referenceName = end.getImmutableName();
            final String display =
                MessageFormat.format(Messages.getString("QueryEditorControl.HierarchyLinkTypeFormat"), new Object[] //$NON-NLS-1$
            {
                end.getOppositeEnd().getName(),
                end.getName()
            });

            if (referenceName.equalsIgnoreCase(initialValue)) {
                selectedItemIndex = list.size();
            }

            list.add(display);
            mapTreeDisplayNameToReferenceName.put(display, referenceName);
        }
    }

    combo.setItems((String[]) list.toArray(new String[list.size()]));
    if (combo.getItemCount() > 0) {
        combo.select(selectedItemIndex);
    }

    combo.addSelectionListener(new ComboTreeOptionsSelectionHandler());
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:36,代碼來源:QueryEditorControl.java

示例14: setWordValue

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void setWordValue(final Combo combo, final NormalColumn targetColumn) {
    Word word = targetColumn.getWord();
    while (word instanceof CopyWord) {
        word = ((CopyWord) word).getOriginal();
    }

    if (word != null) {
        final int index = wordList.indexOf(word);

        combo.select(index + 1);
    }
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:13,代碼來源:EditAllAttributesDialog.java

示例15: ProjectComboField

import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public ProjectComboField(Composite composite, int config, IProjectFilter filter) {
	combo = new Combo(composite, config);
	
	combo.add(NO_PROJECT);
	combo.select(0);
	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	for (IProject project : projects) {
		if (filter == null || filter.accept(project))
			combo.add(project.getName());
	}
}
 
開發者ID:wpilibsuite,項目名稱:EclipsePlugins,代碼行數:12,代碼來源:ProjectComboField.java


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