本文整理匯總了Java中org.eclipse.swt.widgets.Control類的典型用法代碼示例。如果您正苦於以下問題:Java Control類的具體用法?Java Control怎麽用?Java Control使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Control類屬於org.eclipse.swt.widgets包,在下文中一共展示了Control類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createContents
import org.eclipse.swt.widgets.Control; //導入依賴的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;
}
示例2: createContents
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* Create contents of the application window.
*
* @param parent the parent
* @return the control
*/
@Override
protected Control createContents(Composite parent) {
getShell().setText("Execution tracking console - " + consoleName);
getShell().setBounds(50, 250, 450, 500);
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, false));
{
styledText = new StyledText(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
styledText.setEditable(false);
}
statusLineManager.setMessage("Waiting for tracking status from server. Please wait!");
return container;
}
示例3: setupControls
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* Recursive function for setting up children controls for a control if it is
* a composite and setting up the main control's manager.
* @param part
* @param control
*/
private void setupControls(IWorkbenchPart part, Control control) {
//If composite, setup children controls.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
setupControls(part, curControl);
}
}
if (control instanceof StyledText) {
//set up styled text manager if there is one
setupStyledText((IEditorPart) part, (StyledText) control);
} else if (control instanceof Browser) {
//set up browser manager if there is one
setupBrowser((Browser) control);
}
//TODO: no control set up for a ProjectExplorer, since there isn't an need for
//a Manager right now, might be needed in the future
}
示例4: buildContextMenu
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
private void buildContextMenu(MouseEvent e) {
Point point = new Point(e.x, e.y);
TreeItem treeItem = getTree().getItem(point);
Menu menu = new Menu((Control)e.getSource());
Iterator<MenuMaker> i = menuMakers.iterator();
int cpt = 0;
while(i.hasNext()) {
i.next().makeMenu(this, treeItem, e, menu);
if (i.hasNext() && menu.getItemCount() != cpt) {
new MenuItem(menu, SWT.SEPARATOR);
cpt = menu.getItemCount();
}
}
if (menu.getItemCount() > 0) {
menu.setVisible(true);
} else {
menu.dispose();
}
}
示例5: createDialogArea
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
Label labelDescription = new Label(composite, SWT.WRAP);
labelDescription.setText("Limit chars logs");
final Spinner spinnerBox = new Spinner(composite, SWT.WRAP);
spinnerBox.setMaximum(MAX_LOG_CHARS);
spinnerBox.setMinimum(MIN_LOG_CHARS);
spinnerBox.setSelection(limitLogsChars);
spinnerBox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
spinnerBox.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
limitLogsChars = Integer.parseInt(spinnerBox.getText());
}
});
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite.setLayout(new GridLayout(2, false));
return composite;
}
示例6: bindControl
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* Bind a control. If it is a composite, also bind all of its children.
* @param control Highest level control.
* @param unbind If true, unbind instead of bind.
*/
private static void bindControl(IWorkbenchPartReference partRef,
Control control, boolean unbind) {
//If composite, bind children.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
bindControl(partRef, curControl, unbind);
}
}
//control should not have any data set
//upon reaching this part of the method
IGazeHandler handler = GazeHandlerFactory.
createHandler(control, partRef);
if (handler != null && !unbind)
control.setData(KEY_HANDLER, handler);
else
control.setData(KEY_HANDLER, null);
}
示例7: createButtonBar
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
@Override
protected Control createButtonBar(Composite parent) {
final Composite buttonBar = (Composite) super.createButtonBar(parent);
logout = new Button(buttonBar, SWT.CENTER);
final GridData layoutData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
layoutData.widthHint = 100;
logout.setLayoutData(layoutData);
logout.setText("Log Out");
logout.setVisible(credentials.isKeepLogged());
logout.addListener(SWT.Selection, e -> {
credentials.setApplication(null);
credentials.setUserKey(false, null);
close();
});
logout.moveAbove(super.buttonControl);
return buttonBar;
}
示例8: createContents
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
protected Control createContents(Composite parent) {
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.numColumns = 1;
parent.setLayout(gridLayout);
String[] values = PreferenceManager.getAuthorizedFolderForGraphDefinition();
String[] propertyNames = new String[] { PreferenceManager.AUTHORIZED_FOLDERS_FOR_GRAPH_DEFINITION };
authorizedFolders = new CustomListWithButtons(parent, SWT.NONE, true,
new StringCustomListModel(MessageUtil.getString("authorizedfolderforgraphmodel"), values));
authorizedFolders.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
authorizedFolders.setPropertyNames(propertyNames);
values = PreferenceManager.getGraphWalkerJavaLibName();
propertyNames = new String[] { PreferenceManager.GRAPHWALKER_JAVALIBRARIES };
gw4eLibraries = new CustomListWithButtons(parent, SWT.NONE, true,
new StringCustomListModel(MessageUtil.getString("graphwalkerlibraries"), values));
gw4eLibraries.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
gw4eLibraries.setPropertyNames(propertyNames);
return new Canvas(parent, 0);
}
示例9: createContents
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* @see PreferencePage#createContents(Composite)
*/
protected Control createContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL);
data.grabExcessHorizontalSpace = true;
composite.setLayoutData(data);
Preferences prefs = builderPreferences();
addFirstSection(composite);
addSeparator(composite);
addSecondSection(composite, prefs);
addSpecificSection(composite, prefs);
return composite;
}
示例10: createControl
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
final Composite composite= new Composite(parent, SWT.NULL);
composite.setFont(parent.getFont());
composite.setLayout(initGridLayout(new GridLayout(1, false), true));
composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
// create UI elements
Control nameControl= createNameControl(composite);
nameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Control locationControl= createLocationControl(composite);
locationControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Control infoControl= createInfoControl(composite);
infoControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
setControl(composite);
}
示例11: BufferedLabel
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
public
BufferedLabel(
Composite composite,
int attrs )
{
super((attrs&SWT.DOUBLE_BUFFERED)==0?new Label( composite, attrs ):new DoubleBufferedLabel( composite, attrs ));
label = (Control)getWidget();
ClipboardCopy.addCopyToClipMenu(
label,
new ClipboardCopy.copyToClipProvider()
{
@Override
public String
getText()
{
return( BufferedLabel.this.getText());
}
});
}
示例12: setErrorMessage
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* Sets or clears the error message.
* If not <code>null</code>, the OK button is disabled.
*
* @param errorMessage
* the error message, or <code>null</code> to clear
* @since 3.0
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
if (errorMessageText != null && !errorMessageText.isDisposed()) {
errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); //$NON-NLS-1$
// Disable the error message text control if there is no error, or
// no error text (empty or whitespace only). Hide it also to avoid
// color change.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281
boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0;
errorMessageText.setEnabled(hasError);
errorMessageText.setVisible(hasError);
errorMessageText.getParent().update();
// Access the ok button by id, in case clients have overridden button creation.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
Control button = getButton(IDialogConstants.OK_ID);
if (button != null) {
button.setEnabled(errorMessage == null);
}
}
}
示例13: createDialogArea
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.marginWidth = gridLayout.marginHeight = 0;
container.setLayout(gridLayout);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.minimumHeight = 600;
gd.minimumWidth = 1024;
container.setLayoutData(gd);
diffPane = new DiffPaneViewer(container, SWT.NONE);
diffPane.setDbSources(dbProject, dbRemote);
diffPane.setInput(input, availableElements);
return area;
}
示例14: addBasicAuthKeyComposite
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* @param control
* @return
*/
public Control addBasicAuthKeyComposite(Composite control, FTPAuthOperationDetails authOperationDetails){
Composite basicAuthKeyComposite = new Composite(control, SWT.BORDER);
basicAuthKeyComposite.setLayout(new GridLayout(3, false));
basicAuthKeyComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
FTPWidgetUtility ftpWidgetUtility = new FTPWidgetUtility();
ftpWidgetUtility.createLabel(basicAuthKeyComposite, "User ID");
ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);
ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Password");
ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.PASSWORD|SWT.BORDER);
new Button(basicAuthKeyComposite, SWT.NONE).setVisible(false);
ftpWidgetUtility.createLabel(basicAuthKeyComposite, "Public/Private Key");
Text privateKeyTxt = (Text) ftpWidgetUtility.createText(basicAuthKeyComposite, "", SWT.BORDER);
Button keyFileBrwsBtn = new Button(basicAuthKeyComposite, SWT.NONE);
keyFileBrwsBtn.setText("...");
selectionListener(keyFileBrwsBtn, privateKeyTxt);
return basicAuthKeyComposite;
}
示例15: addControlDisposeListener
import org.eclipse.swt.widgets.Control; //導入依賴的package包/類
/**
* Adds a {@link DisposeListener} to the created {@link Control}. Listeners can be added either before or after the
* Control is created.
*
* @param disposeListener The {@link DisposeListener} to add.
*
* @see Control#addControlDisposeListener(DisposeListener)
*/
public void addControlDisposeListener(DisposeListener disposeListener) {
Control control = getControl();
if (control != null) {
if (control.isDisposed()) {
return;
}
control.addDisposeListener(disposeListener);
}
else {
if (_DisposeListeners == null) {
_DisposeListeners = new LinkedHashSet<DisposeListener>();
}
_DisposeListeners.add(disposeListener);
}
}