本文整理匯總了Java中org.eclipse.swt.widgets.Combo.setItems方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.setItems方法的具體用法?Java Combo.setItems怎麽用?Java Combo.setItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.setItems方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
container.setLayout(layout);
// container.setLayoutData(new GridData(GridData.FILL_BOTH));
// TitleArea中的Title
setTitle("屬性文件更新");
// TitleArea中的Message
setMessage("輸入正確的url地址,以更新文件。\n可提示的屬性數量會根據當前項目存在的jar包,對已有屬性增加或者刪除!");
Label label = new Label(container, SWT.NONE);
label.setText("項目URL: ");
combo = new Combo(container, SWT.DROP_DOWN);
String[] items = new String[getUrlMap().size()];
getUrlMap().values().toArray(items);
combo.setItems(items);
String url = getPreferedUrl(projectName);
combo.setText(url);
combo.setLayoutData(new RowData(400, 30));
return area;
}
示例2: 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;
}
示例3: createStandardCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void createStandardCombo ( final Composite parent, final String attributeName, final String label, final String[] items, final IObservableMap data, final Object valueType )
{
this.toolkit.createLabel ( parent, label + ":" );
final Combo combo = new Combo ( parent, SWT.DROP_DOWN );
combo.setItems ( items );
this.toolkit.adapt ( combo );
final GridData gd = new GridData ( GridData.FILL, GridData.BEGINNING, true, true );
gd.horizontalSpan = 2;
combo.setLayoutData ( gd );
final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType );
this.dbc.bindValue ( WidgetProperties.text ().observe ( combo ), value );
}
示例4: attachWidget
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
public void attachWidget(Composite container) {
defaultELTcom = new Combo(container, SWT.READ_ONLY);
defaultELTcom.setItems(defaultTextMessage);
// defaultELTcom.setItems(new String[] {"True","false"});
// defaultELTcom.setItem(0, "");
GridData gd_defaultELTTextBox = new GridData(SWT.FILL, SWT.FILL, false,
false, 1, 1);
if (OSValidator.isMac()) {
gd_defaultELTTextBox.horizontalIndent=-1;
gd_defaultELTTextBox.widthHint = textboxWidth+50;
}
else{
gd_defaultELTTextBox.horizontalIndent=1;
gd_defaultELTTextBox.widthHint = textboxWidth;
}
defaultELTcom.setLayoutData(gd_defaultELTTextBox);
widget = defaultELTcom;
}
示例5: addVersionSection
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void addVersionSection(Composite parent) {
Composite composite = createDefaultComposite(parent);
// Label for owner field
Label ownerLabel = new Label(composite, SWT.NONE);
ownerLabel.setText(LEGACY_VERSION_TITLE);
// Owner text field
legacyVersionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData();
gd.widthHint = convertWidthInCharsToPixels(COMBO_FIELD_WIDTH);
legacyVersionCombo.setLayoutData(gd);
// Populate owner text field
LegacyVersion legacyVersion = LegacyManager.getInstance().getVersion(getProject());
legacyVersionCombo.setItems(LegacyVersion.names());
legacyVersionCombo.setText(legacyVersion.name());
}
示例6: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
// create composite
Composite composite = (Composite) super.createDialogArea(parent);
// create message
if (message != null) {
Label label = new Label(composite, SWT.WRAP);
label.setText(message);
GridData data = new GridData(GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
label.setFont(parent.getFont());
}
combo = new Combo(composite, SWT.DROP_DOWN);
combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL));
combo.setItems(values);
applyDialogFont(composite);
return composite;
}
示例7: addComboBox
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
protected Combo addComboBox(Composite parent, String label, String key, String[] values, String[] valueLabels,
int indent) {
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = indent;
Label labelControl = new Label(parent, SWT.LEFT | SWT.WRAP);
labelControl.setText(label);
labelControl.setLayoutData(gd);
Combo comboBox = new Combo(parent, SWT.READ_ONLY);
SwtUtil.setDefaultVisibleItemCount(comboBox);
comboBox.setItems(valueLabels);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
comboBox.setLayoutData(gd);
comboBox.addSelectionListener(fComboFieldListener);
fComboFields.put(comboBox, key);
return comboBox;
}
示例8: ComboBox
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public ComboBox(Composite composite, String key, String text, String helpID, String [] labels, Object [] values) {
super(key);
fLabels= labels;
fValues= Arrays.asList(values);
final Label label= SWTUtils.createLabel(composite, text);
fCombo= new Combo(composite, SWT.READ_ONLY);
fCombo.setLayoutData(SWTUtils.createHFillGridData());
fCombo.setItems(labels);
if (((GridLayout)composite.getLayout()).numColumns > 1) {
label.setLayoutData(SWTUtils.createGridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
}
if (helpID != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(fCombo, helpID);
}
示例9: initHttpCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void initHttpCombo( Composite top){
httpCombo = new Combo(top, SWT.READ_ONLY);
httpCombo.setItems(CoreConstants.HTTP11_METHODS);
httpCombo.setText(model.getHttpMethod());
httpCombo.addSelectionListener(new SelectionAdapter() {
private String prevMethod = model.getHttpMethod();
public void widgetSelected( SelectionEvent e){
// becomes GET, HEAD, PUT, etc
if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
state.setState(ItemState.POST_DISABLED);
// becomes POST
} else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
state.setState(ItemState.POST_ENABLED);
// no update
} else {
state.setState(ItemState.POST_NO_UPDATE);
}
prevMethod = httpCombo.getText();
model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model));
}
});
}
示例10: 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);
}
示例11: createNgCommandComponent
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void createNgCommandComponent(Composite parent) {
Group group = new Group(parent, SWT.NONE);
String groupName = AngularCLIMessages.AngularCLILaunchTabGroup_MainTab_command;
group.setText(groupName);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
group.setLayout(layout);
group.setLayoutData(gridData);
commandsCommbo = new Combo(group, SWT.BORDER | SWT.H_SCROLL);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
commandsCommbo.setLayoutData(data);
String[] items = new String[NgCommand.values().length];
for (int i = 0; i < items.length; i++) {
items[i] = NgCommand.values()[i].getAliases()[0];
}
commandsCommbo.setItems(items);
commandsCommbo.addModifyListener(fListener);
}
示例12: 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;
}
示例13: createLanguageLayout
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/***
* Create the Field where user enters the language used to execute
*
* @param parent container composite
* @param font used font
* @return the created composite containing the fields
*/
public Composite createLanguageLayout(Composite parent, Font font) {
// Language
createTextLabelLayout(parent, "Melange languages");
_languageCombo = new Combo(parent, SWT.NONE);
_languageCombo.setLayoutData(createStandardLayout());
List<String> languagesNames = MelangeHelper.getAllLanguages();
String[] empty = {};
_languageCombo.setItems(languagesNames.toArray(empty));
_languageCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//String selection = _languageCombo.getText();
//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
updateLaunchConfigurationDialog();
}
});
createTextLabelLayout(parent, "");
createTextLabelLayout(parent, "Melange resource adapter query");
_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
_melangeQueryText.setLayoutData(createStandardLayout());
_melangeQueryText.setFont(font);
_melangeQueryText.setEditable(false);
createTextLabelLayout(parent, "");
return parent;
}
示例14: createType_trigger_combo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* This method initializes type_trigger_combo
*
*/
private void createType_trigger_combo() {
GridData gridData2 = new GridData();
gridData2.horizontalAlignment = GridData.FILL;
gridData2.verticalAlignment = GridData.CENTER;
gridData2.grabExcessHorizontalSpace = true;
type_trigger_combo = new Combo(commun_trigger, SWT.READ_ONLY);
type_trigger_combo.setItems(customTriggers);
type_trigger_combo
.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
int index = type_trigger_combo.getSelectionIndex();
if (index == -1) {
type_trigger_combo.select(0);
} else if (index != last_index && custom_triggers != null) {
help_label.setText(custom_triggers[index].getHelp());
stackLayout.topControl = custom_triggers[index];
custom_trigger.layout();
last_index = index;
if (index == 5) { // NoWait case
timeout_label.setVisible(false);
timeout_spin.setVisible(false);
} else {
timeout_label.setVisible(true);
timeout_spin.setVisible(true);
}
}
}
});
type_trigger_combo.setLayoutData(gridData2);
}
示例15: createContents
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createContents(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
panel.setLayout(layout);
btnForceUnixNewlines = new Button(panel, SWT.CHECK);
btnForceUnixNewlines.setText(Messages.ProjectProperties_force_unix_newlines);
btnForceUnixNewlines.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
btnForceUnixNewlines.setSelection(prefs.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true));
Label label = new Label(panel, SWT.NONE);
label.setText(Messages.projectProperties_timezone_for_all_db_connections);
cmbTimezone = new Combo(panel, SWT.BORDER | SWT.DROP_DOWN);
cmbTimezone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cmbTimezone.setItems(UIConsts.TIME_ZONES.toArray(new String[UIConsts.TIME_ZONES.size()]));
String tz = prefs.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC);
cmbTimezone.setText(tz);
cmbTimezone.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
checkSwitchWarnLbl();
}
});
lblWarn = new CLabel(panel, SWT.NONE);
lblWarn.setImage(Activator.getEclipseImage(ISharedImages.IMG_OBJS_WARN_TSK));
lblWarn.setText(Messages.ProjectProperties_change_projprefs_warn);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false, 2, 1);
gd.exclude = true;
lblWarn.setLayoutData(gd);
lblWarn.setVisible(false);
return panel;
}