Java Code Examples for org.eclipse.swt.layout.GridLayout
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/swt/.
Source file: CanvasWithSlider.java

/** * Sets the layout of the group and lay itens in it. */ private void layThingsOut(){ GridLayout groupLayout=new GridLayout(1,false); group.setLayout(groupLayout); GridData groupLayoutData=new GridData(); groupLayoutData.horizontalAlignment=GridData.FILL_HORIZONTAL; slider.setLayoutData(groupLayoutData); groupLayoutData=new GridData(); groupLayoutData.horizontalAlignment=GridData.CENTER; groupLayoutData.heightHint=canvasSize; groupLayoutData.widthHint=canvasSize; canvas.setLayoutData(groupLayoutData); }
Example 2
From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/gui/swt/.
Source file: WorkspacePropertiesDialog.java

/** * Creates the composite for the dialog buttons. * @return The created composite to be layed out. */ private Composite createButtonsComposite(){ Composite buttonsComposite=new Composite(shell,SWT.NONE); GridLayout buttonsCompositeLayout=new GridLayout(2,true); buttonsComposite.setLayout(buttonsCompositeLayout); GridData buttonsLayoutData; okButton=createOkButton(buttonsComposite); buttonsLayoutData=new GridData(SWT.FILL,SWT.TOP,false,false); okButton.setLayoutData(buttonsLayoutData); Button cancelButton=createCancelButton(buttonsComposite); buttonsLayoutData=new GridData(SWT.FILL,SWT.TOP,false,false); cancelButton.setLayoutData(buttonsLayoutData); return buttonsComposite; }
Example 3
From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.ec2/src/com/amazonaws/eclipse/ec2/ui/securitygroups/.
Source file: CreateSecurityGroupDialog.java

private Composite createComposite(Composite parent){ Composite composite=new Composite(parent,SWT.BORDER); GridLayout gridLayout=new GridLayout(2,false); gridLayout.marginHeight=convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); gridLayout.marginWidth=convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); gridLayout.verticalSpacing=convertVerticalDLUsToPixels(1); gridLayout.horizontalSpacing=convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(gridLayout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); return composite; }
Example 4
From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.ec2/src/com/amazonaws/eclipse/ec2/ui/securitygroups/.
Source file: EditSecurityGroupPermissionEntryDialog.java

private void create(){ GridLayout gridLayout=new GridLayout(1,true); gridLayout.marginWidth=0; setLayout(gridLayout); createLabel("AWS User ID:",this,1); userIdText=createTextBox(this,1); createLabel("AWS Security Group:",this,1); securityGroupText=createTextBox(this,1); pack(); }
Example 5
From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/properties/.
Source file: BELEditorPropertyPage.java

/** * @see PreferencePage#createContents(Composite) */ @Override 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); addFirstSection(composite); addSeparator(composite); addSecondSection(composite); return composite; }
Example 6
From project bel-editor, under directory /org.openbel.editor.ui/src/org/openbel/editor/ui/properties/.
Source file: BELEditorPropertyPage.java

private Composite createDefaultComposite(Composite parent){ Composite composite=new Composite(parent,SWT.NULL); GridLayout layout=new GridLayout(); layout.numColumns=2; composite.setLayout(layout); GridData data=new GridData(); data.verticalAlignment=GridData.FILL; data.horizontalAlignment=GridData.FILL; composite.setLayoutData(data); return composite; }
Example 7
From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/filter/.
Source file: FilterDialog.java

private void addFilterEntryGroup(){ filterEntriesGroup=new Group(container,SWT.NONE); GridLayout layout=new GridLayout(1,false); layout.marginHeight=0; filterEntriesGroup.setLayout(layout); filterEntriesGroup.setLayoutData(new GridData(SWT.FILL,SWT.TOP,true,false,1,1)); }
Example 8
From project bioclipse.speclipse, under directory /plugins/net.bioclipse.nmrshiftdb/src/net/bioclipse/nmrshiftdb/wizards/.
Source file: ClonePage.java

public void createControl(Composite parent){ Composite container=new Composite(parent,SWT.NULL); GridLayout layout=new GridLayout(); container.setLayout(layout); layout.numColumns=1; text=new Text(container,SWT.NULL); text.setText(name + ".new"); GridData gridData3=new GridData(); gridData3.widthHint=200; text.setLayoutData(gridData3); setControl(container); }
Example 9
From project bioclipse.speclipse, under directory /plugins/net.bioclipse.specmol/src/net/bioclipse/specmol/editor/.
Source file: SpecMolPeackChartComposite.java

/** * initializes the composite by creating and adding a peak chart * @param AssignmentPage page */ private void init(AssignmentPage page){ GridLayout layout=new GridLayout(); this.setLayout(layout); GridData layoutData=new GridData(GridData.FILL_BOTH); this.setLayoutData(layoutData); Frame fileTableFrame=SWT_AWT.new_Frame(this); fileTableFrame.setLayout(new BorderLayout()); chart=SpectrumChartFactory.createPeakChart(null,null,null); chart.setTitle("empty chart"); chartPanel=new SpokChartPanel(chart,"peak",null,null); fileTableFrame.add(chartPanel,BorderLayout.CENTER); chartPanel.addMouseListener(page.getPeakChartCompositeMouseListener()); }
Example 10
From project bioclipse.vscreen, under directory /net.bioclipse.vscreen.ui/src/net/bioclipse/vscreen/ui/editors/.
Source file: VScreenEditor.java

@Override public void createPartControl(Composite parent){ GridLayout gridLayout=new GridLayout(); gridLayout.numColumns=1; parent.setLayout(gridLayout); viewer=new TreeViewer(parent,SWT.BORDER | SWT.MULTI | SWT.H_SCROLL| SWT.V_SCROLL); ColumnViewerToolTipSupport.enableFor(viewer); viewer.setContentProvider(new VScreenContentProvider()); viewer.setLabelProvider(new LabelProvider()); GridData gridData=new GridData(GridData.FILL,GridData.FILL,true,true); viewer.getTree().setLayoutData(gridData); viewer.setInput(new String[]{"WEEHOOW"}); }
Example 11
From project bndtools, under directory /bndtools.core/src/bndtools/editor/contents/.
Source file: IncludedResourcesPart.java

void createSection(Section section,FormToolkit toolkit){ section.setText("Import Patterns"); section.setDescription("Resources matching the listed patterns will be included in the bundle."); Composite composite=toolkit.createComposite(section); section.setClient(composite); table=toolkit.createTable(composite,SWT.FULL_SELECTION | SWT.MULTI); GridLayout layout=new GridLayout(2,false); composite.setLayout(layout); GridData gd; gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,3); gd.widthHint=300; gd.heightHint=100; table.setLayoutData(gd); }
Example 12
From project bndtools, under directory /bndtools.core/src/bndtools/editor/workspace/.
Source file: WorkspaceMainPart.java

private void createMissingExtsWarningPanel(Composite parent,FormToolkit tk,IPath extPath){ Composite composite=tk.createComposite(parent); GridLayout layout=new GridLayout(2,false); layout.marginHeight=0; layout.marginWidth=0; composite.setLayout(layout); Label l1=tk.createLabel(composite,"image"); l1.setImage(warningImg); Label l2=tk.createLabel(composite,String.format("No default configuration files found under %s",extPath)); l2.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false)); }
Example 13
From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/launch/.
Source file: BPELLaunchMainTab.java

public void createControl(Composite parent){ Font font=parent.getFont(); Composite comp=new Composite(parent,SWT.NONE); setControl(comp); GridLayout topLayout=new GridLayout(); topLayout.verticalSpacing=0; comp.setLayout(topLayout); comp.setFont(font); createProjectSection(comp); createVerticalSpacer(comp,1); createSuiteSection(comp,"&BPEL Test Suite File:",new Button[]{}); }
Example 14
From project bpelunit, under directory /tycho/net.bpelunit.framework.client.eclipse/src/net/bpelunit/framework/client/eclipse/views/.
Source file: BPELUnitView.java

protected Composite createProgressCountPanel(Composite parent){ Composite composite=new Composite(parent,SWT.NONE); GridLayout layout=new GridLayout(); composite.setLayout(layout); layout.numColumns=1; layout.verticalSpacing=0; createImages(); fCounterPanel=new CounterPanel(composite); fCounterPanel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); fTestCaseProgress=new ProgressPanel(composite,"Test Cases"); fActivityProgress=new ProgressPanel(composite,"Activities"); return composite; }
Example 15
From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/.
Source file: FormLayoutUtils.java

public static GridLayout createFormGridLayout(boolean makeColumnsEqualWidth,int numColumns){ GridLayout layout=new GridLayout(); layout.marginHeight=FORM_BODY_MARGIN_HEIGHT; layout.marginWidth=FORM_BODY_MARGIN_WIDTH; layout.marginTop=FORM_BODY_MARGIN_TOP; layout.marginBottom=FORM_BODY_MARGIN_BOTTOM; layout.marginLeft=FORM_BODY_MARGIN_LEFT; layout.marginRight=FORM_BODY_MARGIN_RIGHT; layout.horizontalSpacing=FORM_BODY_HORIZONTAL_SPACING; layout.verticalSpacing=FORM_BODY_VERTICAL_SPACING; layout.makeColumnsEqualWidth=makeColumnsEqualWidth; layout.numColumns=numColumns; return layout; }
Example 16
From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/exporter/.
Source file: AbstractExporterConfigurationDialog.java

/** * Creates composite control and sets the default layout data. * @param parent the parent of the new composite * @param numColumns the number of columns for the new composite * @return the newly-created coposite */ protected Composite createComposite(Composite parent,int numColumns){ Composite composite=new Composite(parent,SWT.NULL); GridLayout layout=new GridLayout(); layout.numColumns=numColumns; composite.setLayout(layout); GridData data=new GridData(); data.verticalAlignment=GridData.FILL; data.horizontalAlignment=GridData.FILL; composite.setLayoutData(data); return composite; }
Example 17
From project BHT-FPA, under directory /mailer-common/de.bht.fpa.mail.common/src/de/bht/fpa/mail/s000000/common/filter/entry/.
Source file: FilterEntryComponent.java

/** * Create the composite. * @param parent * @param style */ public FilterEntryComponent(final Composite parent){ super(parent,SWT.NONE); GridLayout layout=new GridLayout(NR_OF_COLUMNS,false); layout.marginHeight=0; setLayout(layout); filterTypeComponent=new FilterTypeComponent(this); filterTypeComponent.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false,1,1)); remBtn=new Button(this,SWT.NONE); remBtn.setText("-"); remBtn.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected( SelectionEvent e){ filterChangedListener.onRemoveFilter(FilterEntryComponent.this); } } ); Button addBtn=new Button(this,SWT.NONE); addBtn.setLayoutData(new GridData(SWT.RIGHT,SWT.CENTER,false,false,1,1)); addBtn.setText("+"); addBtn.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected( SelectionEvent e){ filterChangedListener.onAddFilter(FilterEntryComponent.this); } } ); }
Example 18
From project big-data-plugin, under directory /src/org/pentaho/amazon/s3/.
Source file: S3VfsFileChooserDialog.java

public S3VfsFileChooserDialog(VfsFileChooserDialog vfsFileChooserDialog,FileObject rootFile,FileObject initialFile){ super(S3FileProvider.SCHEME,AmazonS3FileSystemBootstrap.getS3FileSystemDisplayText(),vfsFileChooserDialog,SWT.NONE); this.vfsFileChooserDialog=vfsFileChooserDialog; this.rootFile=rootFile; this.initialFile=initialFile; setLayout(new GridLayout()); createConnectionPanel(); initializeConnectionPanel(); }
Example 19
From project big-data-plugin, under directory /src/org/pentaho/di/ui/vfs/hadoopvfsfilechooserdialog/.
Source file: HadoopVfsFileChooserDialog.java

public HadoopVfsFileChooserDialog(VfsFileChooserDialog vfsFileChooserDialog,FileObject rootFile,FileObject initialFile){ super(HadoopSpoonPlugin.HDFS_SCHEME,HadoopSpoonPlugin.HDFS_SCHEME_DISPLAY_NAME,vfsFileChooserDialog,SWT.NONE); this.rootFile=rootFile; this.initialFile=initialFile; this.vfsFileChooserDialog=vfsFileChooserDialog; GridData gridData=new GridData(SWT.FILL,SWT.CENTER,true,false); setLayoutData(gridData); setLayout(new GridLayout(1,false)); createConnectionPanel(); initializeConnectionPanel(); }
Example 20
From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/wizards/export/.
Source file: PrismExportWizard.java

public void createControl(Composite parent){ int textStyle=SWT.RIGHT | SWT.BORDER; int labelStyle=SWT.SINGLE | SWT.LEFT; Composite composite=new Composite(parent,SWT.NONE); composite.setLayout(new GridLayout()); setControl(composite); Label tmpLabel=new Label(composite,labelStyle); tmpLabel.setText("Please set the level size for this translation"); tmpLabel.setLayoutData(createDefaultGridData()); Composite labelsComposite=new Composite(composite,SWT.NONE); GridLayout labelsCompLayout=new GridLayout(2,false); labelsComposite.setLayout(labelsCompLayout); Label levelsLabel=new Label(labelsComposite,labelStyle); levelsLabel.setText("Level size: (default 1)"); levelSizeText=new Text(labelsComposite,textStyle); levelSizeText.setLayoutData(newTextGridData()); levelSizeText.setText(""); levelSizeText.addModifyListener(modifyListener); setPropertiesFile=new Button(labelsComposite,SWT.PUSH); setPropertiesFile.setText("Set .csl"); setPropertiesFile.setEnabled(true); class SetCSL implements SelectionListener { public void widgetSelected( SelectionEvent event){ setCSLFile(); } public void widgetDefaultSelected( SelectionEvent event){ } } setPropertiesFile.addSelectionListener(new SetCSL()); cslFileLabel=new Label(labelsComposite,labelStyle); cslFileLabel.setText("No file set"); outputCslCheckButton=new Button(labelsComposite,SWT.CHECK); outputCslCheckButton.setText("Output csl properties file"); outputCslCheckButton.setSelection(true); validate(); }
Example 21
From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.ui/src/uk/ac/ed/inf/biopepa/ui/wizards/export/.
Source file: SimulationDistributionsWizard.java

public void createControl(Composite parent){ Composite composite=new Composite(parent,SWT.NONE); composite.setLayout(new GridLayout()); setControl(composite); Composite labelsComposite=new Composite(composite,SWT.NONE); GridLayout labelsCompLayout=new GridLayout(2,false); labelsComposite.setLayout(labelsCompLayout); Label targetNameLabel=new Label(labelsComposite,labelStyle); targetNameLabel.setText("Choose the dynamic component: "); targetNameCombo=new Combo(labelsComposite,SWT.READ_ONLY); String[] varNames=model.getDynamicVariableNames(); String[] compNames=model.getComponentNames(); String[] choices=combineStringArrays(varNames,compNames); targetNameCombo.setItems(choices); targetNameCombo.select(0); Label targetValueLabel=new Label(labelsComposite,labelStyle); targetValueLabel.setText("Enter target value"); targetValueText=new Text(labelsComposite,textStyle); targetValueText.setText(Integer.toString(this.defaultTargetValue)); Label stopTimeLabel=new Label(labelsComposite,labelStyle); stopTimeLabel.setText("Set the stop time"); stopTimeText=new Text(labelsComposite,textStyle); stopTimeText.setText(Double.toString(this.defaultStopTime)); stopTimeText.setLayoutData(newTextGridData()); stopTimeText.addModifyListener(modifyListener); Label explainNumberRuns=new Label(labelsComposite,labelStyle); explainNumberRuns.setText("The number of independent runs"); numberRunsText=new Text(labelsComposite,textStyle); numberRunsText.setText(Integer.toString(this.defaultNumberRuns)); numberRunsText.setLayoutData(newTextGridData()); numberRunsText.addModifyListener(modifyListener); Label explainDataPoints=new Label(labelsComposite,labelStyle); explainDataPoints.setText("Set the increment in data point size for the graph"); dataPointsText=new Text(labelsComposite,textStyle); dataPointsText.setText(Double.toString(this.defaultDataPointSize)); dataPointsText.setLayoutData(newTextGridData()); dataPointsText.addModifyListener(modifyListener); enableWidgets(); validate(); }
Example 22
From project bioclipse.opentox, under directory /plugins/net.bioclipse.opentox.ds/src/net/bioclipse/opentox/ds/prefs/.
Source file: ModelsListEditor.java

/** * Returns this field editor's button box containing the Add, Remove, Up, and Down button. * @param parent the parent control * @return the button box */ public Composite getButtonBoxControl(Composite parent){ if (buttonBox == null) { buttonBox=new Composite(parent,SWT.NULL); GridLayout layout=new GridLayout(); layout.marginWidth=0; buttonBox.setLayout(layout); createButtons(buttonBox); buttonBox.addDisposeListener(new DisposeListener(){ public void widgetDisposed( DisposeEvent event){ addButton=null; removeButton=null; upButton=null; downButton=null; buttonBox=null; } } ); } else { checkParent(buttonBox,parent); } selectionChanged(); return buttonBox; }
Example 23
From project bioclipse.opentox, under directory /plugins/net.bioclipse.opentox.ds/src/net/bioclipse/opentox/ds/wizards/.
Source file: SelectModelsPage.java

public void createControl(Composite parent){ wizard=(AddModelsWizard)getWizard(); setTitle("Select Models"); setDescription("Select OpenTox models to include in the " + "Decision Support. "); Composite comp=new Composite(parent,SWT.NONE); GridLayout layout=new GridLayout(); comp.setLayout(layout); viewer=new CheckboxTreeViewer(parent,SWT.CHECK | SWT.MULTI | SWT.H_SCROLL| SWT.V_SCROLL| SWT.BORDER); viewer.setUseHashlookup(true); viewer.setContentProvider(new ServicesContentProvider()); viewer.setLabelProvider(new ServicesLabelProvider()); IPreferenceStore store=Activator.getDefault().getPreferenceStore(); String servicePrefs=store.getString(OpenToxModelsPrefsPage.OT_MODELS_PREFS); String[] serviceStrings=OpenToxModelsPrefsPage.parsePreferenceString(servicePrefs); viewer.setInput(serviceStrings); viewer.expandToLevel(2); GridData data=new GridData(GridData.FILL_BOTH); data.grabExcessHorizontalSpace=true; data.grabExcessVerticalSpace=true; data.heightHint=400; data.widthHint=300; viewer.getControl().setLayoutData(data); viewer.addCheckStateListener(new ICheckStateListener(){ @Override public void checkStateChanged( CheckStateChangedEvent event){ System.out.println("Changed in viewer: " + event.getElement() + " - "+ event.getChecked()); } } ); setControl(comp); }
Example 24
From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/editor/.
Source file: MetadataPage.java

protected void createFormContent(IManagedForm managedForm){ SenecaJobSpecification specification=((SenecaJobEditor)this.getEditor()).getSpecification(); final ScrolledForm form=managedForm.getForm(); FormToolkit toolkit=managedForm.getToolkit(); form.setText("General Information"); GridLayout layout=new GridLayout(3,false); form.getBody().setLayout(layout); toolkit.createLabel(form.getBody(),"Job Title:"); jobTitle=toolkit.createText(form.getBody(),specification.getJobTitle(),SWT.BORDER); GridData gData=new GridData(GridData.FILL_HORIZONTAL); gData.horizontalSpan=2; jobTitle.setLayoutData(gData); jobTitle.addModifyListener(new EditorModifyListener(this)); toolkit.createLabel(form.getBody(),"Molecular Formula:"); mfData=toolkit.createText(form.getBody(),specification.getMolecularFormula(),SWT.BORDER); mfData.setLayoutData(gData); mfData.addModifyListener(new EditorModifyListener(this)); toolkit.createLabel(form.getBody(),"Carbon hydrogen count:"); for (int i=0; i < 4; i++) { toolkit.createLabel(form.getBody(),"CH" + i,SWT.BORDER); dataFile[i]=toolkit.createText(form.getBody(),Integer.toString(specification.getDeptData(i)),SWT.BORDER); gData=new GridData(SWT.LEFT); gData.horizontalSpan=1; dataFile[i].setLayoutData(gData); dataFile[i].addModifyListener(new EditorModifyListener(this)); if (i < 4 - 1) toolkit.createComposite(form.getBody()); } toolkit.createLabel(form.getBody(),"Do aromaticity detection during run"); detectAromaticity=toolkit.createButton(form.getBody(),"",SWT.CHECK); detectAromaticity.addSelectionListener(new SelectionListener(){ public void widgetDefaultSelected( SelectionEvent e){ setDirty(true); } public void widgetSelected( SelectionEvent e){ setDirty(true); } } ); detectAromaticity.setSelection(specification.getDetectAromaticity()); }
Example 25
From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/job/.
Source file: StochasticJobMonitor.java

public StochasticJobMonitor(Composite parent,int maxT,int maxS){ super(parent,SWT.NO_SCROLL); this.isCancelled=false; GridLayout l=new GridLayout(); l.numColumns=1; l.makeColumnsEqualWidth=true; l.marginBottom=5; l.marginLeft=5; l.marginRight=5; l.marginTop=5; setLayout(l); this.logPane=new AnnealingLogPane(this,maxT,maxS); this.progress=new ProgressIndicator(this,SWT.HORIZONTAL); this.pack(); }
Example 26
From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/.
Source file: AbstractBpmn2PropertiesComposite.java

/** * NB! Must call setEObject for updating contents and rebuild the UI. * @param parent * @param style */ public AbstractBpmn2PropertiesComposite(Composite parent,int style){ super(parent,style); this.parent=parent; bindingContext=new DataBindingContext(); addDisposeListener(new DisposeListener(){ @Override public void widgetDisposed( DisposeEvent e){ toolkit.dispose(); } } ); toolkit.adapt(this); toolkit.paintBordersFor(this); setLayout(new GridLayout(3,false)); }
Example 27
From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/.
Source file: BPMN2DiagramWizardPage.java

/** * @see IDialogPage#createControl(Composite) */ @Override public void createControl(Composite parent){ Composite container=new Composite(parent,SWT.NULL); GridLayout layout=new GridLayout(); container.setLayout(layout); layout.numColumns=3; layout.verticalSpacing=9; Label label=new Label(container,SWT.NULL); label.setText("&Location:"); containerText=new Text(container,SWT.BORDER | SWT.SINGLE); GridData gd=new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener(new ModifyListener(){ @Override public void modifyText( ModifyEvent e){ dialogChanged(); } } ); Button button=new Button(container,SWT.PUSH); button.setText("Browse..."); button.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected( SelectionEvent e){ handleBrowse(); } } ); label=new Label(container,SWT.NULL); label.setText("&File name:"); fileText=new Text(container,SWT.BORDER | SWT.SINGLE); gd=new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener(new ModifyListener(){ @Override public void modifyText( ModifyEvent e){ dialogChanged(); } } ); initialize(); dialogChanged(); setControl(container); }
Example 28
From project adt-cdt, under directory /com.android.ide.eclipse.adt.cdt/src/com/android/ide/eclipse/adt/cdt/internal/preferences/.
Source file: NDKPreferencePage.java

/** * Create contents of the preference page. * @param parent */ @Override public Control createContents(Composite parent){ Composite container=new Composite(parent,SWT.NULL); container.setLayout(new GridLayout(1,false)); Group grpNdkLocation=new Group(container,SWT.NONE); grpNdkLocation.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false,1,1)); grpNdkLocation.setText("NDK Location"); grpNdkLocation.setLayout(new GridLayout(2,false)); text=new Text(grpNdkLocation,SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false,1,1)); String ndkLoc=NDKManager.getNDKLocation(); if (ndkLoc != null) text.setText(ndkLoc); Button button=new Button(grpNdkLocation,SWT.NONE); button.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected( SelectionEvent e){ String dir=new DirectoryDialog(NDKPreferencePage.this.getShell()).open(); if (dir != null) text.setText(dir); } } ); button.setText("Browse..."); return container; }