类org.eclipse.swt.widgets.Label源码实例Demo

下面列出了怎么用org.eclipse.swt.widgets.Label的API类实例代码及写法,或者点击链接到github查看源代码。


public void fill(Composite parent) {
	super.fill(parent);
	Composite container = new Composite(parent, SWT.NONE);
	GridLayout gl = new GridLayout(2, false);
	gl.marginWidth = 5;
	gl.marginHeight = 3;
	container.setLayout(gl);

	progressBar = new ProgressBar(container, SWT.SMOOTH);
	GridData gdPprogressBar = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
	gdPprogressBar.heightHint = 16;
	gdPprogressBar.widthHint = 130;
	progressBar.setLayoutData(gdPprogressBar);
	progressBar.setMinimum(0); // 最小值
	progressBar.setMaximum(100);// 最大值
	progressBar.setSelection(progressValue);
	progressBar.setToolTipText(defaultMessage);

	label = new Label(container, SWT.None);
	label.setText(progressValue + "%");

	StatusLineLayoutData data = new StatusLineLayoutData();
	container.setLayoutData(data);
}
 
源代码2 项目: neoscada   文件: ChartManager.java

public ChartManager ( final Composite parent, final int style )
{
    super ( parent, style );

    setLayout ( makeLayout () );

    // title row

    this.title = new Label ( this, SWT.NONE );
    this.title.setLayoutData ( new GridData ( GridData.CENTER, GridData.FILL, true, false, 1, 1 ) );

    // row 2

    this.chartArea = new ChartArea ( this, SWT.NONE );
    this.chartArea.setLayoutData ( makeMainLayoutData () );

    addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            onDispose ();
        }
    } );
}
 

private void createExecutionEventControl(final EMFDataBindingContext dbc, final Composite parent) {
    final Label eventLabel = new Label(parent, SWT.NONE);
    eventLabel.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
    eventLabel.setText(Messages.connectorEventLabel);

    final Composite eventRadioGroup = new Composite(parent, SWT.NONE);
    eventRadioGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    eventRadioGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(20, 0, 0, 15).create());

    final Button inRadio = createRadioButton(eventRadioGroup, Messages.bind(Messages.connectorInChoice, ConnectorEvent.ON_ENTER.name()));
    final Button outRadio = createRadioButton(eventRadioGroup, Messages.bind(Messages.connectorOutChoice, ConnectorEvent.ON_FINISH.name()));

    final SelectObservableValue eventObservable = new SelectObservableValue(String.class);
    eventObservable.addOption(ConnectorEvent.ON_ENTER.name(), SWTObservables.observeSelection(inRadio));
    eventObservable.addOption(ConnectorEvent.ON_FINISH.name(), SWTObservables.observeSelection(outRadio));
    dbc.bindValue(eventObservable, connectorEventObservable);
}
 
源代码4 项目: spotbugs   文件: ReportConfigurationTab.java

private void createPriorityGroup(Composite parent) {
    Composite prioGroup = new Composite(parent, SWT.NONE);
    prioGroup.setLayout(new GridLayout(2, false));

    Label minPrioLabel = new Label(prioGroup, SWT.NONE);
    minPrioLabel.setText(getMessage("property.minPriority"));
    minPrioLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    minPriorityCombo = new Combo(prioGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    minPriorityCombo.add(ProjectFilterSettings.HIGH_PRIORITY);
    minPriorityCombo.add(ProjectFilterSettings.MEDIUM_PRIORITY);
    minPriorityCombo.add(ProjectFilterSettings.LOW_PRIORITY);
    minPriorityCombo.setText(propertyPage.getOriginalUserPreferences().getFilterSettings().getMinPriority());
    minPriorityCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    minPriorityCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            String data = minPriorityCombo.getText();
            getCurrentProps().getFilterSettings().setMinPriority(data);
        }
    });


}
 
源代码5 项目: hop   文件: DetailsDialog.java

@Override
protected Control createMessageArea( Composite composite ) {
  GridLayout gridLayout = (GridLayout) composite.getLayout();
  gridLayout.numColumns = 1;
  composite.setLayout( gridLayout );

  if ( this.message != null ) {
    this.messageLabel = new Label( composite, this.getMessageLabelStyle() );
    this.messageLabel.setText( this.message );
  }

  if ( this.details != null ) {
    this.detailsText = new Text( composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
    this.detailsText.pack();
    this.detailsText.setText( this.details );
    GridData gridData = new GridData();
    gridData.widthHint = 1024;
    gridData.heightHint = 300;
    this.detailsText.setLayoutData( gridData );
    this.detailsText.setSelection( this.details.length() );
  }

  return composite;
}
 

private void createClassNameInput(Composite result) {
	Label label= new Label(result, SWT.LEAD);
	label.setText(RefactoringMessages.IntroduceParameterObjectWizard_classnamefield_label);
	final Text text= new Text(result, SWT.SINGLE | SWT.BORDER);
	text.setText(fProcessor.getClassName());
	text.selectAll();
	text.setFocus();
	text.addModifyListener(new ModifyListener() {

		public void modifyText(ModifyEvent e) {
			fProcessor.setClassName(text.getText());
			updateSignaturePreview();
			validateRefactoring();
		}

	});
	text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
 

@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	GridDataFactory.fillDefaults().grab(true, true).hint(300, 50).minSize(300, 50).applyTo(tparent);

	Composite nameCmp = new Composite(tparent, SWT.NONE);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
	GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);

	Label nameLbl = new Label(nameCmp, SWT.NONE);
	nameLbl.setText(Messages.getString("srx.CreateOrUpdataSRXDialog.nameLbl"));

	nameTxt = new Text(nameCmp, SWT.BORDER);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(nameTxt);

	return tparent;
}
 

@Override
protected Control createContents(Composite parent) {
	final Composite container = new Composite(parent, SWT.FILL);
	container.setLayout(new GridLayout(1, true));
	notifyBasicPreferenceListeners(container);

	new Label(container, SWT.NONE);
	final ExpandableComposite collap = new ExpandableComposite(container, SWT.Collapse);
	collap.setText("Advanced Options");

	final Composite advancedOptions = new Composite(collap, SWT.None);
	collap.setClient(advancedOptions);
	advancedOptions.setLayout(new RowLayout(SWT.VERTICAL));
	notifyAdvancedPreferenceListeners(advancedOptions);

	collap.setExpanded(true);
	return container;
}
 
源代码9 项目: n4js   文件: SpecProcessPage.java

/**
 * (non-Javadoc) Method declared on IDialogPage.
 */
@Override
public void createControl(Composite parent) {
	setPageComplete(true);
	initializeDialogUnits(parent);

	Composite composite = new Composite(parent, SWT.NULL);
	composite.setLayout(new GridLayout());
	composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

	new Label(composite, SWT.NONE).setText("Messages:");
	createErrorGroup(composite);

	Display display = getShell().getDisplay();
	highlightColor = display.getSystemColor(SWT.COLOR_RED);

	setControl(composite);
}
 
源代码10 项目: ermaster-b   文件: CompositeFactory.java

public static Label createExampleLabel(Composite composite, String title,
		int span) {
	Label label = new Label(composite, SWT.NONE);
	label.setText(ResourceString.getResourceString(title));

	if (span > 0) {
		GridData gridData = new GridData();
		gridData.horizontalSpan = span;
		label.setLayoutData(gridData);
	}

	FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
	Font font = new Font(Display.getCurrent(), fontData.getName(), 8,
			SWT.NORMAL);
	label.setFont(font);

	return label;
}
 

@Override
protected Control createDialogArea(Composite parent) {
  Composite composite = (Composite) super.createDialogArea(parent);

  new Label(composite, SWT.WRAP).setText(""); //$NON-NLS-1$

  String sAddToFlowPrompt = Messages
          .getString("MultiResourceSelectionDialogWithFlowOption.addSelectedAEsToEndOfFlow"); //$NON-NLS-1$
  FormToolkit factory = new FormToolkit(TAEConfiguratorPlugin.getDefault().getFormColors(
          parent.getDisplay()));

  autoAddToFlowButton = factory.createButton(composite, sAddToFlowPrompt, SWT.CHECK);
  m_bAutoAddToFlow = "false".equals(CDEpropertyPage.getAddToFlow(editor.getProject())) ? false : true;
  autoAddToFlowButton.setSelection(m_bAutoAddToFlow);
  autoAddToFlowButton.setBackground(null);

  return composite;
}
 

@Override
protected Control createDialogArea(final Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayout(new GridLayout(2, false));
	Label l1 = new Label(ret, SWT.NONE);
	l1.setText(Messages.AccountView_date);
	dpc = new CDateTime(ret, CDT.HORIZONTAL | CDT.DATE_SHORT | CDT.DROP_DOWN | SWT.BORDER | CDT.TAB_FIELDS);
	String value = java.time.LocalDate.now().format(DateTimeFormatter.ofPattern("01.01.y"));
	dpc.setSelection(new TimeTool(value).getTime());
	dpc.setToolTipText(Messages.MultiplikatorEditor_PleaseEnterBeginDate);
	Label label = new Label(ret, SWT.NONE);
	label.setText(Messages.Leistungscodes_multiplierLabel);
	multi = new Text(ret, SWT.BORDER);
	multi.setTextLimit(6);
	multi.setToolTipText(Messages.MultiplikatorEditor_NewMultipilcator);
	multi.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	return ret;
}
 

@Override
protected void createFieldEditors(){
	Label expl = new Label(getFieldEditorParent(), SWT.WRAP);
	expl.setText(Messages.TextTemplatePreferences_ExplanationLine1
		+ Messages.TextTemplatePreferences_ExplanationLine2
		+ Messages.TextTemplatePreferences_ExplanationLine3);
	expl.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false));
	addField(new StringFieldEditor(SUFFIX_STATION, SUFFIX_FOR_THIS_STATION,
		getFieldEditorParent()));
	/*
	 * IExtensionRegistry exr = Platform.getExtensionRegistry(); IExtensionPoint exp =
	 * exr.getExtensionPoint("ch.elexis.documentTemplates"); if (exp != null) { IExtension[]
	 * extensions = exp.getExtensions(); for (IExtension ex : extensions) {
	 * IConfigurationElement[] elems = ex.getConfigurationElements(); for (IConfigurationElement
	 * el : elems) { String n=el.getAttribute("name"); addField(new StringFieldEditor(BRANCH+n,
	 * n, getFieldEditorParent())); } }
	 * 
	 * }
	 */
}
 

protected void createReturnTypeComposite(final Composite parent) {
    final Composite typeComposite = new Composite(parent, SWT.NONE);
    typeComposite.setLayoutData(GridDataFactory.fillDefaults()
            .grab(true, false).create());
    final GridLayout gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    typeComposite.setLayout(gl);

    final Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText(Messages.returnType);
    typeLabel.setLayoutData(GridDataFactory.fillDefaults()
            .align(SWT.FILL, SWT.CENTER).create());

    typeText = new Text(typeComposite, SWT.BORDER | SWT.READ_ONLY);
    typeText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
            .align(SWT.FILL, SWT.CENTER).indent(10, 0).create());
}
 

private void createNote(final Composite parent, final Question question) {
	final Group notePanel = new Group(parent, SWT.NONE);
	notePanel.setText("Note:");
	final Font boldFont = new Font(notePanel.getDisplay(), new FontData(Constants.ARIAL, 10, SWT.BOLD));
	notePanel.setFont(boldFont);

	this.note = new Text(notePanel, SWT.MULTI | SWT.WRAP);
	this.note.setLayoutData(new GridData(GridData.FILL_BOTH));
	this.note.setText(Constants.DESCRIPTION_KEYSIZES);
	this.note.setBounds(10, 20, 585, 60);
	this.note.setSize(this.note.computeSize(585, SWT.DEFAULT));
	setControl(notePanel);
	this.note.setEditable(false);
	this.note.setEnabled(true);
	new Label(parent, SWT.NULL);
}
 

public Control createContents(Composite parent) {
	if (getCompareResult() instanceof String) {		
		
		setMessage("Testing");
		
		Composite composite = new Composite(parent, SWT.NULL);
		GridLayout layout = new GridLayout();
		layout.numColumns = 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(GridData.FILL_BOTH));			
		Label iconLabel = new Label(composite, SWT.WRAP);
		iconLabel.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));			
		Label errorLabel = new Label(composite, SWT.WRAP);
		GridData gd = new GridData();
		gd.widthHint = 500;
		errorLabel.setLayoutData(gd);
		errorLabel.setText((String)getCompareResult());
		parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
		composite.setBackground(parent.getBackground());
		errorLabel.setBackground(parent.getBackground());
		iconLabel.setBackground(parent.getBackground());
		return composite;
	}
	return super.createContents(parent);
}
 

public Control createControl(Composite composite) {
	fOverlayStore.load();
	fOverlayStore.start();

	Composite inner= new Composite(composite, SWT.NONE);
	GridLayout layout= new GridLayout(1, true);
	layout.verticalSpacing= 3;
	layout.marginWidth= 0;
	inner.setLayout(layout);

	Label label= new Label(inner, SWT.LEFT);
	label.setText(FoldingMessages.DefaultJavaFoldingPreferenceBlock_title);

	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_comments, PreferenceConstants.EDITOR_FOLDING_JAVADOC, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_headers, PreferenceConstants.EDITOR_FOLDING_HEADERS, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_innerTypes, PreferenceConstants.EDITOR_FOLDING_INNERTYPES, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_methods, PreferenceConstants.EDITOR_FOLDING_METHODS, 0);
	addCheckBox(inner, FoldingMessages.DefaultJavaFoldingPreferenceBlock_imports, PreferenceConstants.EDITOR_FOLDING_IMPORTS, 0);

	return inner;
}
 
源代码18 项目: tracecompass   文件: FilterViewer.java

FilterTraceTypeNodeComposite(Composite parent, TmfFilterTraceTypeNode node) {
    super(parent, node);
    fNode = node;
    fTraceTypeMap = getTraceTypeMap(fNode.getTraceTypeId());

    Label label = new Label(this, SWT.NONE);
    label.setText(Messages.FilterViewer_TypeLabel);

    fTypeCombo = new CCombo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
    fTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fTypeCombo.setItems(fTraceTypeMap.keySet().toArray(new String[0]));
    if (fNode.getTraceTypeId() != null) {
        fTypeCombo.setText(fNode.getName());
    }
    fTypeCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TraceTypeHelper helper = checkNotNull(fTraceTypeMap.get(fTypeCombo.getText()));
            fNode.setTraceTypeId(helper.getTraceTypeId());
            fNode.setTraceClass(helper.getTraceClass());
            fNode.setName(fTypeCombo.getText());
            fViewer.refresh(fNode);
        }
    });
}
 
源代码19 项目: erflute   文件: CompositeFactory.java

public static Combo createCombo(AbstractDialog dialog, Composite composite, String title, int span) {
    if (title != null) {
        final Label label = new Label(composite, SWT.RIGHT);
        label.setText(DisplayMessages.getMessage(title));
    }

    final GridData gridData = new GridData();
    gridData.horizontalSpan = span;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;

    final Combo combo = new Combo(composite, SWT.NONE);
    combo.setLayoutData(gridData);

    ListenerAppender.addComboListener(combo, dialog, false);

    return combo;
}
 

private void createButtonComposite(Composite composite) {
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	composite.setLayout(layout);

	new Label(composite, SWT.NONE);
}
 

private void createButtonComposite(Composite parent) {
	Composite buttonComp= new Composite(parent, SWT.NONE);
	GridLayout gl= new GridLayout();
	gl.marginHeight= 0;
	gl.marginWidth= 0;
	buttonComp.setLayout(gl);
	buttonComp.setLayoutData(new GridData(GridData.FILL_VERTICAL));

	SelectionAdapter adapter= new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			handleButtonPressed(e.widget);
		}
	};

	fExternalizeButton= createTaskButton(buttonComp, NLSUIMessages.ExternalizeWizardPage_Externalize_Selected, adapter);
	fIgnoreButton= createTaskButton(buttonComp, NLSUIMessages.ExternalizeWizardPage_Ignore_Selected, adapter);
	fInternalizeButton= createTaskButton(buttonComp, NLSUIMessages.ExternalizeWizardPage_Internalize_Selected, adapter);

	new Label(buttonComp, SWT.NONE); // separator

	fEditButton= createTaskButton(buttonComp, NLSUIMessages.ExternalizeWizardPage_Edit_key_and_value, adapter);
	fRevertButton= createTaskButton(buttonComp, NLSUIMessages.ExternalizeWizardPage_Revert_Selected, adapter);
	fRenameButton= createTaskButton(buttonComp, NLSUIMessages.ExternalizeWizardPage_Rename_Keys, adapter);

	fEditButton.setEnabled(false);
	fRenameButton.setEnabled(false);
	buttonComp.pack();
}
 

protected void createAdvancedModeDescriptionControl(
        final Composite choicesComposite) {
    final Label choiceDescriptionLabel = new Label(choicesComposite, SWT.WRAP);
    choiceDescriptionLabel
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(160, SWT.DEFAULT).span(2, 1).create());
    choiceDescriptionLabel.setText(Messages.graphicalModeDescription);
}
 
源代码23 项目: olca-app   文件: ProviderRow.java

private void fireSelect(Label label, IProvider provider) {
	label.setText(label(provider));
	label.getParent().pack();
	if (onSelect != null) {
		onSelect.accept(provider);
	}
}
 

/**
 * 创建要分割文件的显示区
 * @param tparent
 */
public void createSplitXlfNameGroup(Composite tparent) {
	final Group xliffDataGroup = new Group(tparent, SWT.NONE);
	GridLayoutFactory.fillDefaults().numColumns(2).margins(8, 8).applyTo(xliffDataGroup);
	GridDataFactory.fillDefaults().grab(true, false).applyTo(xliffDataGroup);
	xliffDataGroup.setText(Messages.getString("wizard.SplitXliffWizardPage.xliffDataGroup"));

	GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false);
	textData.widthHint = 200;

	Label xlfNameLbl = new Label(xliffDataGroup, SWT.RIGHT);
	xlfNameLbl.setText(Messages.getString("wizard.SplitXliffWizardPage.xlfNameLbl"));
	GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(xlfNameLbl);

	xliffNameTxt = new Text(xliffDataGroup, SWT.BORDER);
	xliffNameTxt.setText(splitFile.getFullPath().toOSString());
	GridDataFactory.fillDefaults().grab(true, false).applyTo(xliffNameTxt);
	xliffNameTxt.setEditable(false);

	Label targetFilsPathLbl = new Label(xliffDataGroup, SWT.RIGHT);
	targetFilsPathLbl.setText(Messages.getString("wizard.SplitXliffWizardPage.targetFilsPathLbl"));
	GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(targetFilsPathLbl);

	targetXlfPathTxt = new Text(xliffDataGroup, SWT.BORDER);
	targetXlfPathTxt.setLayoutData(textData);
	targetXlfPathTxt.setText(splitFile.getParent().getFullPath().append(splitFile.getName() + "_split")
			.toOSString());
	targetXlfPathTxt.setEditable(false);

	if ("\\".equals(System.getProperty("file.separator"))) {
		separator = "\\";
	} else {
		separator = "/";
	}

	validXliff();
}
 
源代码25 项目: tmxeditor8   文件: PluginHelpDialog.java

@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	tparent.setLayout(new GridLayout());
	tparent.setLayoutData(new GridData(GridData.FILL_BOTH));

	Label logo = new Label(tparent, SWT.BORDER);
	logo.setImage(Activator.getImageDescriptor(PluginConstants.HELP_SPLASH).createImage());

	return tparent;
}
 
源代码26 项目: ermaster-b   文件: RelationDialog.java

private int createParentGroup(Composite composite) {
	GridLayout gridLayout = new GridLayout();
	gridLayout.verticalSpacing = 10;
	gridLayout.marginHeight = 10;

	GridData gridData = new GridData();
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;

	Group group = new Group(composite, SWT.NONE);
	group.setLayoutData(gridData);
	group.setLayout(gridLayout);
	group.setText(ResourceString.getResourceString("label.parent"));

	Composite upperComposite = new Composite(group, SWT.NONE);
	upperComposite.setLayoutData(gridData);
	upperComposite.setLayout(gridLayout);

	Label label1 = new Label(upperComposite, SWT.NONE);
	label1.setText(ResourceString
			.getResourceString("label.reference.table"));
	parentTableNameText = new Text(upperComposite, SWT.BORDER
			| SWT.READ_ONLY);
	parentTableNameText.setLayoutData(gridData);

	Label label2 = new Label(upperComposite, SWT.NONE);
	label2.setText(ResourceString
			.getResourceString("label.reference.column"));
	this.createColumnCombo(upperComposite);

	this.createParentMandatoryGroup(group);

	upperComposite.pack();

	return upperComposite.getSize().y;
}
 
源代码27 项目: neoscada   文件: ChartInputSelectorView.java

@Override
public void createPartControl ( final Composite parent )
{
    this.parent = parent;
    this.placeholder = new Label ( parent, SWT.NONE );
    this.placeholder.setText ( "Select a chart view to see input channels" );

    attachSelectionService ();
}
 
源代码28 项目: EasyShell   文件: UtilsUI.java

static public Label createLabel(Composite parent, String imageId, String text, String tooltip) {
    Label label = new Label(parent, SWT.LEFT);
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    if (text != null) {
        label.setText(text);
        label.setToolTipText(tooltip);
    }
    label.setImage(Activator.getImage(imageId));
    return label;
}
 
源代码29 项目: slr-toolkit   文件: SplitTermDialog.java

@Override
protected Control createDialogArea(Composite parent) {
        Composite container = (Composite) super.createDialogArea(parent);
        GridLayout layout = new GridLayout(2, false);
        layout.marginRight = 5;
        layout.marginLeft = 10;
        container.setLayout(layout);
        
        new Label(container, SWT.NONE).setText("Split Term: ");
        new Label(container, SWT.NONE).setText(this.selectedTermName);
        
        new Label(container, SWT.NONE).setText("Default Term*: ");
        this.defaultTermNameText = new Text(container, SWT.BORDER);
        this.defaultTermNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        this.defaultTermNameText.setText("");
        this.defaultTermNameText.addModifyListener((e) -> {
        	if (((Text) e.getSource()).getText() == null || ((Text) e.getSource()).getText().isEmpty()) {
        		getButton(IDialogConstants.OK_ID).setEnabled(false);
        	} else {
        		getButton(IDialogConstants.OK_ID).setEnabled(true);
        	}
        }); 
        
        new Label(container, SWT.NONE).setText("Further Terms (comma-seperated): ");
        this.furtherTermNamesText = new Text(container, SWT.BORDER | SWT.V_SCROLL);                		
        return container;
}
 
源代码30 项目: ermasterr   文件: CompositeFactory.java

public static Text createTextArea(final AbstractDialog dialog, final Composite composite, final String title, final int width, final int height, final int span, final boolean selectAll, final boolean imeOn, final boolean indent) {
    if (title != null) {
        final Label label = new Label(composite, SWT.NONE);

        final GridData labelGridData = new GridData();
        labelGridData.verticalAlignment = SWT.TOP;
        labelGridData.horizontalAlignment = SWT.LEFT;

        label.setLayoutData(labelGridData);

        label.setText(ResourceString.getResourceString(title));
    }

    final GridData textAreaGridData = new GridData();
    textAreaGridData.heightHint = height;
    textAreaGridData.horizontalSpan = span;

    if (width > 0) {
        textAreaGridData.widthHint = width;
    } else {
        textAreaGridData.horizontalAlignment = GridData.FILL;
        textAreaGridData.grabExcessHorizontalSpace = true;
    }

    if (title != null && indent) {
        textAreaGridData.horizontalIndent = Resources.INDENT;
    }

    final Text text = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
    text.setLayoutData(textAreaGridData);

    ListenerAppender.addTextAreaListener(text, dialog, selectAll, imeOn);

    return text;
}
 
 类所在包
 同包方法