Java Code Examples for org.eclipse.swt.widgets.Label#setLayoutData()
The following examples show how to use
org.eclipse.swt.widgets.Label#setLayoutData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScenePrefsViewPart.java From depan with Apache License 2.0 | 6 votes |
private Composite setupFrameRate(Composite parent) { Composite baseComposite = new Composite(parent, SWT.NONE); baseComposite.setLayout(new GridLayout(2, false)); Label rateLabel = new Label(baseComposite, SWT.NONE); rateLabel.setText("Frames per second"); frameRate = new Label(baseComposite, SWT.RIGHT); rateLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); frameRate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); frameCount = 0; frameUpdate = frameCount + 20; framePrev = frameCount; timePrev = System.currentTimeMillis(); return baseComposite; }
Example 2
Source File: WaitDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control createContents(Composite parent) { centerDialogOnScreen(getShell()); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setLayoutData(new GridData(CENTER, CENTER, true, true)); composite.setRedraw(true); Label imgLabel = new Label(composite, SWT.NONE); imgLabel.setImage(iconImage); textLabel = new Label(composite, SWT.NONE); textLabel.setLayoutData(new GridData(CENTER, CENTER, true, true)); textLabel.setFont(GUIHelper.getFont(new FontData("Arial", 9, SWT.BOLD))); textLabel.setRedraw(true); textLabel.setText(msg); return composite; }
Example 3
Source File: BusinessObjectDataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected Text createNameControl(final Composite mainComposite, final EMFDataBindingContext ctx) { final Label nameLabel = new Label(mainComposite, SWT.NONE); nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); nameLabel.setText(Messages.name + " *"); final Text nameText = new Text(mainComposite, SWT.BORDER); nameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); ctx.bindValue(SWTObservables.observeText(nameText, SWT.Modify), EMFObservables.observeValue(businessObjectData, ProcessPackage.Literals.ELEMENT__NAME), updateValueStrategy().withValidator(multiValidator() .addValidator(maxLengthValidator(Messages.name, 50)) .addValidator(groovyReferenceValidator(Messages.name).startsWithLowerCase()) .addValidator(uniqueDataNameValidator()).create()) .create(), null); return nameText; }
Example 4
Source File: ParameterDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
private void setLabelLayoutData( Label label ) { GridData gd = new GridData( ); if ( label.getText( ).equals( LABEL_VALUES ) ) { gd.verticalAlignment = GridData.BEGINNING; } label.setLayoutData( gd ); }
Example 5
Source File: SWTFactory.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static Label createCenteredLabel(Composite parent, String text) { Label l = new Label(parent, SWT.NONE); l.setText(text); GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1); l.setLayoutData(gd); return l; }
Example 6
Source File: OffsetDialog.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private void createAdvancedMessage(final Composite parent) { fAdvancedMessageLabel = new Label(parent, SWT.WRAP); fAdvancedMessageLabel.setText(Messages.OffsetDialog_AdvancedMessage); GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); gd.widthHint = 0; gd.heightHint = SWT.DEFAULT; fAdvancedMessageLabel.setLayoutData(gd); }
Example 7
Source File: InputURLDialog.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
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 CCombo(composite, getInputComboStyle()); combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); combo.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageText.setBackground(errorMessageText.getDisplay() .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); errorMessageText.setForeground(errorMessageText.getDisplay() .getSystemColor(SWT.COLOR_RED)); // Set the error message text // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 setErrorMessage(errorMessage); applyDialogFont(composite); return composite; }
Example 8
Source File: AbstractSearchIndexPage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
protected Label createLabel(Composite composite, int style, String string, int cols) { Label label = new Label(composite, style); label.setText(string); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, cols, 1)); label.setFont(composite.getFont()); return label; }
Example 9
Source File: NumberRangeDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private Text createLine( ModifyListener lsMod, String lableText, Control prevControl ) { // Value line Label lable = new Label( shell, SWT.RIGHT ); lable.setText( lableText ); props.setLook( lable ); FormData lableFormData = new FormData(); lableFormData.left = new FormAttachment( 0, 0 ); lableFormData.right = new FormAttachment( props.getMiddlePct(), -Const.MARGIN ); // In case it is the first control if ( prevControl != null ) { lableFormData.top = new FormAttachment( prevControl, Const.MARGIN ); } else { lableFormData.top = new FormAttachment( 0, Const.MARGIN ); } lable.setLayoutData( lableFormData ); Text control = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( control ); control.addModifyListener( lsMod ); FormData widgetFormData = new FormData(); widgetFormData.left = new FormAttachment( props.getMiddlePct(), 0 ); // In case it is the first control if ( prevControl != null ) { widgetFormData.top = new FormAttachment( prevControl, Const.MARGIN ); } else { widgetFormData.top = new FormAttachment( 0, Const.MARGIN ); } widgetFormData.right = new FormAttachment( 100, 0 ); control.setLayoutData( widgetFormData ); return control; }
Example 10
Source File: SVNWizardPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
protected Label createWrappingLabel(Composite parent, String text, int indent, int horizontalSpan) { Label label = new Label(parent, SWT.LEFT | SWT.WRAP); label.setText(text); GridData data = new GridData(); data.horizontalSpan = horizontalSpan; data.horizontalAlignment = GridData.FILL; data.horizontalIndent = indent; data.grabExcessHorizontalSpace = true; data.widthHint = LABEL_WIDTH_HINT; label.setLayoutData(data); return label; }
Example 11
Source File: ComboDialogField.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public Control[] doFillIntoGrid(Composite parent, int nColumns) { assertEnoughColumns(nColumns); Label label= getLabelControl(parent); label.setLayoutData(gridDataForLabel(1)); Combo combo= getComboControl(parent); combo.setLayoutData(gridDataForCombo(nColumns - 1)); return new Control[] { label, combo }; }
Example 12
Source File: JarRefactoringDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Creates a new label. * * @param parent * the parent control * @param text * the label text * @return the new label control */ protected Label createPlainLabel(Composite parent, String text) { Label label= new Label(parent, SWT.NONE); label.setText(text); label.setFont(parent.getFont()); GridData data= new GridData(); data.verticalAlignment= GridData.FILL; data.horizontalAlignment= GridData.FILL; label.setLayoutData(data); return label; }
Example 13
Source File: AbstractSection.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * New labeled text field. * * @param parent the parent * @param labelKey the label key * @param textToolTip the text tool tip * @param style the style * @return the text */ protected Text newLabeledTextField(Composite parent, String labelKey, String textToolTip, int style) { enableBorders(parent); Label label = toolkit.createLabel(parent, labelKey); label.setToolTipText(textToolTip); if ((style & SWT.V_SCROLL) == SWT.V_SCROLL) { label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); } return newTextWithTip(parent, "", style, textToolTip); //$NON-NLS-1$ }
Example 14
Source File: DeleteResourceAndCloseEditorAction.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); String text1; if (projects.length == 1) { IProject project = (IProject) projects[0]; if (project == null || project.getLocation() == null) { text1 = IDEWorkbenchMessages.DeleteResourceAction_deleteContentsN; } else { text1 = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_deleteContents1, project.getLocation() .toOSString()); } } else { text1 = IDEWorkbenchMessages.DeleteResourceAction_deleteContentsN; } Label tipLbl = new Label(composite, SWT.NONE); tipLbl.setFont(parent.getFont()); tipLbl.setText(text1); deleteContent = true; Label detailsLabel = new Label(composite, SWT.LEFT); detailsLabel.setText(IDEWorkbenchMessages.DeleteResourceAction_deleteContentsDetails); detailsLabel.setFont(parent.getFont()); // indent the explanatory label GridData data = new GridData(); data.horizontalIndent = IDialogConstants.INDENT; detailsLabel.setLayoutData(data); // add a listener so that clicking on the label selects the // corresponding radio button. // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172574 // Add a spacer label new Label(composite, SWT.LEFT); return composite; }
Example 15
Source File: WizardPreviewProvider.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void createInfoBar() { Composite infoComposite = new Composite(this, SWT.BORDER); infoComposite .setLayoutData(GridDataFactory.fillDefaults() .grab(true, false) .create()); infoComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).create()); infoLabel = new Label(infoComposite, SWT.NONE); infoLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); }
Example 16
Source File: ImportWorkspaceControlSupplier.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private Control createStatusControl(Section parent) { final Label statusReport = new Label(parent, SWT.NONE); statusReport.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); statusReport.setText(workspaceModel.buildReport()); return statusReport; }
Example 17
Source File: ApplicationLayoutOneUIPanel.java From XPagesExtensionLibrary with Apache License 2.0 | 4 votes |
@Override protected void createContents(Composite parent) { initDataNode(parent); parent.setLayout(createChildLayout(1)); Composite topComp = new Composite(parent, SWT.NONE); topComp.setLayout(createChildLayout(2)); Label imageLabel = new Label(topComp, SWT.NONE); Image image = ExtLibToolingPlugin.getImage("AppLayout_DialogPic2.png"); //$NON-NLS-1$ imageLabel.setImage(image); GridData gd = new GridData(); imageLabel.setLayoutData(gd); Text descLabel = new Text(topComp, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP); descLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); GridData gdesc = new GridData(GridData.FILL_BOTH); gdesc.grabExcessVerticalSpace = true; gdesc.grabExcessHorizontalSpace = true; gdesc.widthHint = 210; descLabel.setLayoutData(gdesc); String desc = ""; //$NON-NLS-1$ FacesRegistry registry = getExtraData().getDesignerProject().getFacesRegistry(); FacesDefinition def = registry.findDef(EXT_LIB_NAMESPACE_URI, EXT_LIB_TAG_ONEUI_CONFIGURATION); if (null != def) { DesignerExtension ext = (DesignerExtension)def.getExtension(DESIGNER_EXTENSION); if (ext != null) { desc = ext.getDescription(); } } descLabel.setText(desc); descLabel.update(); // null for checked value because runtime default if "on" (true) ExtLibRegistryUtil.Default defBanner = ExtLibRegistryUtil.getDefaultValue(registry, EXT_LIB_TAG_ONEUI_CONFIGURATION, EXT_LIB_ATTR_BANNER, String.valueOf(true)); createDCCheckBox(EXT_LIB_ATTR_BANNER, defBanner.trueValue(), defBanner.falseValue(), "&Banner -- Area at the top of the page for branding and global links", null); // $NLX-ApplicationLayoutOneUIPanel.BannerAreaatthetopofthepageforbra-1$ ExtLibRegistryUtil.Default defTitleBar = ExtLibRegistryUtil.getDefaultValue(registry, EXT_LIB_TAG_ONEUI_CONFIGURATION, EXT_LIB_ATTR_TITLE_BAR, String.valueOf(true)); createDCCheckBox(EXT_LIB_ATTR_TITLE_BAR, defTitleBar.trueValue(), defTitleBar.falseValue(), "&Title bar -- Area for application title and search controls", null); // $NLX-ApplicationLayoutOneUIPanel.TitlebarAreaforapplicationtitlea-1$ ExtLibRegistryUtil.Default defPlaceBar = ExtLibRegistryUtil.getDefaultValue(registry, EXT_LIB_TAG_ONEUI_CONFIGURATION, EXT_LIB_ATTR_PLACE_BAR, String.valueOf(true)); createDCCheckBox(EXT_LIB_ATTR_PLACE_BAR, defPlaceBar.trueValue(), defPlaceBar.falseValue(), "&Place bar -- Area for secondary title and action buttons", null); // $NLX-ApplicationLayoutOneUIPanel.PlacebarAreaforsecondarytitleanda-1$ ExtLibRegistryUtil.Default defFooter = ExtLibRegistryUtil.getDefaultValue(registry, EXT_LIB_TAG_ONEUI_CONFIGURATION, EXT_LIB_ATTR_FOOTER, String.valueOf(true)); createDCCheckBox(EXT_LIB_ATTR_FOOTER, defFooter.trueValue(), defFooter.falseValue(), "&Footer -- Area under the content area for links and text", null); // $NLX-ApplicationLayoutOneUIPanel.FooterAreaunderthecontentareaforl-1$ ExtLibRegistryUtil.Default defLegal = ExtLibRegistryUtil.getDefaultValue(registry, EXT_LIB_TAG_ONEUI_CONFIGURATION, EXT_LIB_ATTR_FOOTER, String.valueOf(true)); createDCCheckBox(ConfigurationLegal.ATTR_LEGAL, defLegal.trueValue(), defLegal.falseValue(), "&Legal -- Area at the bottom of the page for the legal information", null); // $NLX-ApplicationLayoutOneUIPanel.LegalAreaatthebottomofthepagefort-1$ createThemeCombo(); }
Example 18
Source File: MQTTConsumerDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override protected void buildSetup( Composite wSetupComp ) { props.setLook( wSetupComp ); FormLayout setupLayout = new FormLayout(); setupLayout.marginHeight = 15; setupLayout.marginWidth = 15; wSetupComp.setLayout( setupLayout ); Label wlConnection = new Label( wSetupComp, SWT.LEFT ); props.setLook( wlConnection ); wlConnection.setText( BaseMessages.getString( PKG, "MQTTConsumerDialog.Connection" ) ); FormData fdlConnection = new FormData(); fdlConnection.left = new FormAttachment( 0, 0 ); fdlConnection.top = new FormAttachment( 0, 0 ); fdlConnection.right = new FormAttachment( 50, 0 ); wlConnection.setLayoutData( fdlConnection ); wConnection = new TextVar( transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wConnection ); wConnection.addModifyListener( lsMod ); FormData fdConnection = formDataBelow( wlConnection, INPUT_WIDTH, 5 ); wConnection.setLayoutData( fdConnection ); Label wlClientId = new Label( wSetupComp, SWT.LEFT ); props.setLook( wlClientId ); wlClientId.setText( BaseMessages.getString( PKG, "MQTTConsumerDialog.ClientId" ) ); FormData fdlClientId = formDataBelow( wConnection, INPUT_WIDTH, 5 ); wlClientId.setLayoutData( fdlClientId ); wClientId = new TextVar( transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wClientId ); wClientId.addModifyListener( lsMod ); FormData fdClientId = formDataBelow( wlClientId, INPUT_WIDTH, 5 ); wClientId.setLayoutData( fdClientId ); Label wlTopics = new Label( wSetupComp, SWT.LEFT ); props.setLook( wlTopics ); wlTopics.setText( BaseMessages.getString( PKG, "MQTTConsumerDialog.Topics" ) ); FormData fdlTopics = formDataBelow( wClientId, INPUT_WIDTH, 5 ); wlTopics.setLayoutData( fdlTopics ); wQOS = new ComboVar( transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wQOS ); wQOS.addModifyListener( lsMod ); FormData fdQOS = new FormData(); fdQOS.left = new FormAttachment( 0, 0 ); fdQOS.bottom = new FormAttachment( 100, 0 ); fdQOS.width = 135; wQOS.setLayoutData( fdQOS ); wQOS.add( "0" ); wQOS.add( "1" ); wQOS.add( "2" ); Label wlQOS = new Label( wSetupComp, SWT.LEFT ); props.setLook( wlQOS ); wlQOS.setText( BaseMessages.getString( PKG, "MQTTConsumerDialog.QOS" ) ); FormData fdlQOS = new FormData(); fdlQOS.left = new FormAttachment( 0, 0 ); fdlQOS.bottom = new FormAttachment( wQOS, -5 ); fdlQOS.right = new FormAttachment( 50, 0 ); wlQOS.setLayoutData( fdlQOS ); // Put last so it expands with the dialog. Anchoring itself to QOS Label and the Topics Label buildTopicsTable( wSetupComp, wlTopics, wlQOS ); }
Example 19
Source File: NodeAttachDebugTab.java From wildwebdeveloper with Eclipse Public License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { super.createControl(parent); Composite composite = (Composite)getControl(); Composite rootMapComposite = new Composite(composite, SWT.NONE); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).span(((GridLayout)composite.getLayout()).numColumns, 1).grab(true, false).indent(0, 40).applyTo(rootMapComposite); rootMapComposite.setLayout(new GridLayout(3, false)); Label rootMapDescription = new Label(rootMapComposite, SWT.NONE); rootMapDescription.setText(Messages.NodeAttach_rootMapDescription); rootMapDescription.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 3, 1)); GridDataFactory indentFactory = GridDataFactory.swtDefaults().indent(20, 0); Label remoteRootLabel = new Label(rootMapComposite, SWT.NONE); remoteRootLabel.setText(Messages.NodeAttach_remoteRoot); indentFactory.applyTo(remoteRootLabel); remoteRootText = new Text(rootMapComposite, SWT.BORDER); remoteRootText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1)); remoteRootText.addModifyListener(e -> { setDirty(true); updateLaunchConfigurationDialog(); }); Label localRootLabel = new Label(rootMapComposite, SWT.NONE); localRootLabel.setText(Messages.NodeAttach_localRoot); indentFactory.applyTo(localRootLabel); localRootText = new Text(rootMapComposite, SWT.BORDER); localRootText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); Button browseLocalButton = new Button(rootMapComposite, SWT.PUSH); browseLocalButton.setText(Messages.AbstractRunHTMLDebugTab_browse); browseLocalButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> { DirectoryDialog directoryDialog = new DirectoryDialog(browseLocalButton.getShell()); directoryDialog.setText(Messages.NodeAttach_localRoot); String selectedDirString = directoryDialog.open(); if (selectedDirString != null) { localRootText.setText(selectedDirString); } })); ControlDecoration invalidDirectoryDecoration = new ControlDecoration(localRootText, SWT.TOP | SWT.LEFT); invalidDirectoryDecoration.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage()); invalidDirectoryDecoration.setDescriptionText(Messages.NodeAttach_invalidLocalRootDirectory); invalidDirectoryDecoration.hide(); localRootText.addModifyListener(e -> { if (!localRootText.getText().isEmpty() && !new File(localRootText.getText()).isDirectory()) { invalidDirectoryDecoration.show(); setWarningMessage(Messages.NodeAttach_invalidLocalRootDirectory); } else { invalidDirectoryDecoration.hide(); setWarningMessage(null); } setDirty(true); updateLaunchConfigurationDialog(); }); }
Example 20
Source File: BasePanel.java From nebula with Eclipse Public License 2.0 | 4 votes |
protected void createLeftLabel(Composite composite, String text) { final Label lbl = new Label(composite, SWT.NONE); lbl.setText(text); lbl.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WHITE)); lbl.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); }