本文整理匯總了Java中org.eclipse.swt.widgets.List.setItems方法的典型用法代碼示例。如果您正苦於以下問題:Java List.setItems方法的具體用法?Java List.setItems怎麽用?Java List.setItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.List
的用法示例。
在下文中一共展示了List.setItems方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCustomArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates and returns the contents of an area of the dialog which appears
* below the message and above the button bar.
*
* This implementation creates two labels and two textfields.
*
* @param parent parent composite to contain the custom area
* @return the custom area control, or <code>null</code>
*/
protected Control createCustomArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new GridLayout());
skVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
skVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
skVarList.setItems(items);
skVarList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
selections = skVarList.getSelectionIndices();
}});
return composite;
}
示例2: createContents
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
protected Control createContents(Composite parent) {
Label trackerListLabel = new Label(parent, SWT.NONE);
trackerListLabel.setText("Eye Tracker Interface");
//Get currently selected eye tracker type as index into list.
TrackerType[] trackerKeys = EyeTrackerFactory.getAvailableEyeTrackers()
.keySet().toArray(new TrackerType[0]);
int trackerSelectionIndex = Arrays.asList(trackerKeys).indexOf(
TrackerType.valueOf(getPreferenceStore()
.getString(EYE_TRACKER_TYPE)));
//Create tracker list.
trackerList = new List(parent, SWT.BORDER);
String[] items = EyeTrackerFactory.getAvailableEyeTrackers().values()
.toArray(new String[0]);
trackerList.setItems(items);
trackerList.setSelection(trackerSelectionIndex);
return parent;
}
示例3: createCustomArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates and returns the contents of an area of the dialog which appears
* below the message and above the button bar.
*
* This implementation creates two labels and two textfields.
*
* @param parent parent composite to contain the custom area
* @return the custom area control, or <code>null</code>
*/
protected Control createCustomArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new GridLayout());
envVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
envVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
envVarList.setItems(items);
envVarList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
selections = envVarList.getSelectionIndices();
}});
return composite;
}
示例4: createTemplateControl
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates a list element containing available templates (system and user)
* and a text area next to it for showing description about the selected template
*
* @param composite the parent container
*/
private void createTemplateControl(Composite composite) {
// add list for templates
templateList = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
templateList.setItems(ProjectTemplateManager.loadTemplateNames());
templateList.setLayoutData(new GridData(GridData.FILL_VERTICAL));
templateList.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateTooltip"));
templateList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
attributes.setTemplate(templateList.getSelection()[0]);
updateEntries();
}});
templateList.setSelection(0);
// this has to be done, because setSelection() doesn't generate an event
attributes.setTemplate(templateList.getItem(0));
// add TextField for the selected template's description
descriptionField = new Text(composite, SWT.MULTI | SWT.BORDER);
descriptionField.setToolTipText(TexlipsePlugin.getResourceString("projectWizardTemplateDescriptionTooltip"));
descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH));
descriptionField.setEditable(false);
}
示例5: createPopup
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
void createPopup(String[] items, int selectionIndex) {
// create shell and list
popup = new Shell (getShell(), SWT.NO_TRIM | SWT.ON_TOP);
int style = getStyle();
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
list = new List (popup, listStyle);
if (font != null) list.setFont(font);
if (foreground != null) list.setForeground(foreground);
if (background != null) list.setBackground(background);
int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose};
for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
if (items != null) list.setItems(items);
if (selectionIndex != -1) list.setSelection(selectionIndex);
}
示例6: doLoad
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Load the values from preferences.
* @see super.doLoad()
*/
protected void doLoad() {
super.doLoad();
registry.load(getPreferenceStore());
List list = getListControl(parent);
list.setItems(addPaths(TexlipsePlugin.getPreferenceArray(ViewerAttributeRegistry.VIEWER_NAMES)));
}
示例7: doLoadDefault
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Load the default values from preferences.
* @see super.doLoadDefault()
*/
protected void doLoadDefault() {
super.doLoadDefault();
registry = new ViewerAttributeRegistry();
List list = getListControl(parent);
list.setItems(addPaths(TexlipsePlugin.getPreferenceArray(ViewerAttributeRegistry.VIEWER_NAMES)));
}
示例8: showInList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void showInList(List inlist) {
String[] ilarray = new String[Math.max(operands.size() - 1, 0)];
if (operands.size() > 0)
for (int i = 1; i < operands.size(); i++)
ilarray[i - 1] = operands.get(i).toXString();
inlist.setItems(ilarray);
}
示例9: showInList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void showInList(List inlist) {
String[] ilarray = new String[Math.max(operands.size() - 1, 0)];
if (operands.size() > 0)
for (int i = 1; i < operands.size(); i++)
ilarray[i - 1] = operands.get(i).toSQLString();
inlist.setItems(ilarray);
}
示例10: createDialogArea
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea (Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
container.setLayout(gridLayout);
final Label filterLabel = new Label(container, SWT.NONE);
filterLabel.setLayoutData(new GridData(GridData.BEGINNING,
GridData.BEGINNING, false, false, 2, 1));
filterLabel.setText("Select the column that you want to delete:");
final Label nameLabel = new Label(container, SWT.NONE);
nameLabel.setLayoutData(new GridData(GridData.END,
GridData.CENTER, false, false));
nameLabel.setText("Column:");
final List columnList = new List(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
columnList.setBounds(40, 20, 220, 100);
columnList.setItems(columnTitle);
columnList.addSelectionListener(
new SelectionAdapter() {
public void widgetSelected (SelectionEvent e) {
selectedColumn.clear();
selectedColumn.addAll(Arrays.asList(columnList.getSelection()));
}});
return container;
}
示例11: createPopup
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
void createPopup(String[] items, int selectionIndex) {
// create shell and list
popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP);
int style = getStyle();
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ((style & SWT.FLAT) != 0)
listStyle |= SWT.FLAT;
if ((style & SWT.RIGHT_TO_LEFT) != 0)
listStyle |= SWT.RIGHT_TO_LEFT;
if ((style & SWT.LEFT_TO_RIGHT) != 0)
listStyle |= SWT.LEFT_TO_RIGHT;
list = new List(popup, listStyle);
if (font != null)
list.setFont(font);
if (foreground != null)
list.setForeground(foreground);
if (background != null)
list.setBackground(background);
int[] popupEvents = { SWT.Close, SWT.Paint };
for (int i = 0; i < popupEvents.length; i++)
popup.addListener(popupEvents[i], listener);
int[] listEvents = { SWT.MouseUp, SWT.Selection, SWT.Traverse,
SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.FocusOut, SWT.Dispose };
for (int i = 0; i < listEvents.length; i++)
list.addListener(listEvents[i], listener);
if (items != null)
list.setItems(items);
if (selectionIndex != -1)
list.setSelection(selectionIndex);
}
示例12: createAreaWithoutPredefinedOptions
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void createAreaWithoutPredefinedOptions(Composite container) {
listConfiguredElements = new List(container, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
listConfiguredElements.setItems(configuredElementsToArray());
GridData listGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
listGridData.heightHint = ITEM_LIST_HEIGHT_HINT;
listConfiguredElements.setLayoutData(listGridData);
Composite controlComp = new Composite(container, SWT.NONE);
controlComp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
controlComp.setLayout(new GridLayout(2, true));
textNewItem = new Text(controlComp, SWT.BORDER);
textNewItem.setFocus();
GridData textGridData = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
textNewItem.setLayoutData(textGridData);
btnRemove = new Button(controlComp, SWT.NONE);
btnRemove.setToolTipText("Remove the selected item from the list.");
btnRemove.setText("Remove");
btnRemove.setEnabled(false);
btnRemove.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
btnAdd = new Button(controlComp, SWT.NONE);
btnAdd.setToolTipText("Add the new item to the list.");
btnAdd.setText("Add");
btnAdd.setEnabled(false);
btnAdd.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
createButtonActionsWithoutPredefinedOptions();
createListListener();
createTextListener();
}
示例13: createContents
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Creates the page components.
*/
protected Control createContents(Composite parent) {
Composite field = new Composite(parent, SWT.NONE);
GridData fgd = new GridData(GridData.FILL_BOTH);
fgd.horizontalSpan = 3;
field.setLayoutData(fgd);
GridLayout gl = new GridLayout();
gl.numColumns = 2;
field.setLayout(gl);
Label label = new Label(field, SWT.LEFT);
label.setText(TexlipsePlugin.getResourceString("preferenceProjectTemplateLabel"));
label.setLayoutData(new GridData());
Label empty = new Label(field, SWT.LEFT);
empty.setLayoutData(new GridData());
templateList = new List(field, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
templateList.setItems(ProjectTemplateManager.loadUserTemplateNames());
templateList.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite column = new Composite(field, SWT.NONE);
column.setLayoutData(new GridData(GridData.FILL_BOTH));
column.setLayout(new GridLayout());
Button remove = new Button(column, SWT.PUSH);
remove.setText(TexlipsePlugin.getResourceString("preferenceProjectTemplateRemoveButton"));
remove.setLayoutData(new GridData());
remove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
int s = templateList.getSelectionIndex();
if (s >= 0) {
boolean reallyDelete = MessageDialog.openConfirm(new Shell(),
TexlipsePlugin.getResourceString("preferenceProjectTemplateConfirmTitle"),
TexlipsePlugin.getResourceString("preferenceProjectTemplateConfirmDelete").replaceAll("%s", templateList.getItem(s)));
if (reallyDelete) {
String item = templateList.getItem(s);
ProjectTemplateManager.deleteUserTemplate(item);
templateList.remove(s);
}
}
}});
Label spacer = new Label(column, SWT.LEFT);
spacer.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL));
return field;
}
示例14: createPopup
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
void createPopup( String[] items, int selectionIndex )
{
// create shell and list
popup = new Shell( getShell( ), SWT.NO_TRIM | SWT.ON_TOP );
int style = getStyle( );
int listStyle = SWT.SINGLE | SWT.V_SCROLL;
if ( ( style & SWT.FLAT ) != 0 )
listStyle |= SWT.FLAT;
if ( ( style & SWT.RIGHT_TO_LEFT ) != 0 )
listStyle |= SWT.RIGHT_TO_LEFT;
if ( ( style & SWT.LEFT_TO_RIGHT ) != 0 )
listStyle |= SWT.LEFT_TO_RIGHT;
list = new List( popup, listStyle );
if ( font != null )
list.setFont( font );
if ( foreground != null )
list.setForeground( foreground );
if ( background != null )
list.setBackground( background );
int[] popupEvents = {
SWT.Close, SWT.Paint, SWT.Deactivate
};
for ( int i = 0; i < popupEvents.length; i++ )
popup.addListener( popupEvents[i], listener );
int[] listEvents = {
SWT.MouseUp,
SWT.Selection,
SWT.Traverse,
SWT.KeyDown,
SWT.KeyUp,
SWT.FocusIn,
SWT.Dispose
};
for ( int i = 0; i < listEvents.length; i++ )
list.addListener( listEvents[i], listener );
if ( items != null )
list.setItems( items );
if ( selectionIndex != -1 )
list.setSelection( selectionIndex );
}