List of usage examples for org.eclipse.swt.widgets Composite Composite
public Composite(Composite parent, int style)
From source file:TabComplex.java
/** * Gets the control for tab three//w w w. j a v a2s . c o m * * @param tabFolder the parent tab folder * @return Control */ private Control getTabThreeControl(TabFolder tabFolder) { // Create some labels and text fields Composite composite = new Composite(tabFolder, SWT.NONE); composite.setLayout(new RowLayout()); new Label(composite, SWT.LEFT).setText("Label One:"); new Text(composite, SWT.BORDER); new Label(composite, SWT.RIGHT).setText("Label Two:"); new Text(composite, SWT.BORDER); return composite; }
From source file:Ch11WizardComposite.java
public void createControl(Composite parent) { Composite topLevel = new Composite(parent, SWT.NONE); topLevel.setLayout(new GridLayout(2, false)); Label l = new Label(topLevel, SWT.CENTER); l.setText("Enter the directory to use:"); text = new Text(topLevel, SWT.SINGLE); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); setControl(topLevel);/*from ww w.java 2s . co m*/ setPageComplete(true); }
From source file:tools.descartes.bungee.viewer.DemandView.java
@Override public void createPartControl(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); Composite chartParent = new Composite(composite, SWT.NONE); GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; chartParent.setLayoutData(gridData); showIntensityButton = new Button(composite, SWT.CHECK); showIntensityButton.setText("Show Intensity"); showIntensityButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.Selection: redrawChart();//from w w w . ja va 2s . com break; } } }); doCalibrationButton = new Button(composite, SWT.CHECK); doCalibrationButton.setText("Do Calibration"); doCalibrationButton.setSelection(true); doCalibrationButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { switch (e.type) { case SWT.Selection: redrawChart(); break; } } }); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(listener); composite.setLayout(new GridLayout()); chartParent.setLayout(new FillLayout()); this.parent = chartParent; }
From source file:org.emftrace.quarc.ui.views.RatioView.java
/** * shows a SpiderChart for the CompareElementsEditorPart * @param sourcepart a CompareElementsEditorPart */// w w w . j av a 2 s . c om protected void showSpiderChartForElementsToCompare(CompareElementsEditor sourcepart) { if ((!parentComposite.isDisposed() && (composite == null || composite.isDisposed()))) { composite = new Composite(parentComposite, SWT.NONE); composite.setLayout(new FillLayout()); final TabFolder tabFolder = new TabFolder(composite, SWT.BOTTOM); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tabFolder.setLayout(new FillLayout()); TabItem gTabItem = new TabItem(tabFolder, SWT.NONE); gTabItem.setText("ratings to goals"); TabItem pTabItem = new TabItem(tabFolder, SWT.NONE); pTabItem.setText("ratings to principles/flaws"); gTabItem.setControl(buildSpiderChartForRatings(sourcepart, tabFolder, true, false)); pTabItem.setControl(buildSpiderChartForRatings(sourcepart, tabFolder, false, false)); if (!sourcepart.getCacheManager().getSelectedGoals().isEmpty()) { TabItem wgTabItem = new TabItem(tabFolder, SWT.NONE); wgTabItem.setText("weighted ratings to goals"); wgTabItem.setControl(buildSpiderChartForRatings(sourcepart, tabFolder, true, true)); } if (!sourcepart.getCacheManager().getSelectedPrinciples().isEmpty()) { TabItem wpTabItem = new TabItem(tabFolder, SWT.NONE); wpTabItem.setText("weighted ratings to principles/flaws"); wpTabItem.setControl(buildSpiderChartForRatings(sourcepart, tabFolder, false, true)); } composite.layout(); parentComposite.layout(); } }
From source file:org.jcryptool.visual.verifiablesecretsharing.views.ReconstructionChartComposite.java
private void createBody() { body = new Composite(this, SWT.NONE); body.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); body.setLayout(new FillLayout()); chart = createChart(createDataset()); chartComposite = new ChartComposite(body, SWT.None, chart, true); }
From source file:SampleListViewer.java
private void addButtons() { Composite composite = new Composite(shell, SWT.NULL); FillLayout fillLayout = new FillLayout(SWT.VERTICAL); fillLayout.spacing = 2;/*from w w w .j av a 2s . c om*/ composite.setLayout(fillLayout); buttonAdd = new Button(composite, SWT.PUSH); buttonAdd.setText("Add"); buttonModify = new Button(composite, SWT.PUSH); buttonModify.setText("Modify"); buttonRemove = new Button(composite, SWT.PUSH); buttonRemove.setText("Remove"); buttonAdd.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // String text = OptionPane.showInputDialog(shell, "New language genre: ", "Add new element", null); // if(text != null) { // languages.add(new Language(text, true)); // } listViewer.refresh(false); } }); buttonModify.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) listViewer.getSelection(); Language language = (Language) selection.getFirstElement(); if (language == null) { System.out.println("Please select a language first."); return; } // String text = OptionPane.showInputDialog(shell, "Rename: ", "Modify genre", language.genre); // if(text != null) { // language.genre = text; // } listViewer.update(language, null); } }); buttonRemove.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) listViewer.getSelection(); Language language = (Language) selection.getFirstElement(); if (language == null) { System.out.println("Please select a language first."); return; } languages.remove(language); System.out.println("Removed: " + language); listViewer.refresh(false); } }); }
From source file:BackupFiles.java
/** * Helper method to create the label/text/button for a directory * /*www.ja va 2 s . c om*/ * @param composite * the parent composite * @param label * the text for the label * @return Text */ private Text createFilePanelHelper(Composite composite, String label) { // Create the composite to hold the controls Composite panel = new Composite(composite, SWT.BORDER); panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); panel.setLayout(new GridLayout(3, false)); // Create the controls new Label(panel, SWT.LEFT).setText(label); Text text = new Text(panel, SWT.BORDER); text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Button browse = new Button(panel, SWT.PUSH); // Add browsing browse.setText("..."); browse.addSelectionListener(new DirectoryBrowser(text)); // Return the Text that holds the directory return text; }
From source file:ummisco.gama.ui.views.displays.SWTChartEditor.java
/** * Creates a new editor./*from w ww . j ava 2s.c om*/ * * @param display * the display. * @param chart2edit * the chart to edit. */ public SWTChartEditor(final Display display, final JFreeChart chart2edit, final Point position) { this.shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.NO_TRIM); this.shell.setSize(400, 500); this.shell.setBackground(WorkbenchHelper.getDisplay().getSystemColor(SWT.COLOR_BLACK)); // this.shell.setAlpha(140); this.chart = chart2edit; this.shell.setText("Chart properties"); this.shell.setLocation(position); final GridLayout layout = new GridLayout(2, false); layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 5; this.shell.setLayout(layout); final Composite main = new Composite(this.shell, SWT.NONE); main.setLayout(new FillLayout()); main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); final TabFolder tab = new TabFolder(main, SWT.BORDER); // build first tab final TabItem item1 = new TabItem(tab, SWT.NONE); item1.setText(" " + "Title" + " "); this.titleEditor = new SWTTitleEditor(tab, SWT.NONE, this.chart.getTitle()); item1.setControl(this.titleEditor); // build second tab final TabItem item2 = new TabItem(tab, SWT.NONE); item2.setText(" " + "Plot" + " "); this.plotEditor = new SWTPlotEditor(tab, SWT.NONE, this.chart.getPlot()); item2.setControl(this.plotEditor); // build the third tab final TabItem item3 = new TabItem(tab, SWT.NONE); item3.setText(" " + "Other" + " "); this.otherEditor = new SWTOtherEditor(tab, SWT.NONE, this.chart); item3.setControl(this.otherEditor); // ok and cancel buttons final Button cancel = new Button(this.shell, SWT.PUSH); cancel.setText(" Cancel "); cancel.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); cancel.pack(); cancel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { SWTChartEditor.this.shell.dispose(); } }); final Button ok = new Button(this.shell, SWT.PUSH | SWT.OK); ok.setText(" Ok "); ok.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false)); ok.pack(); ok.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { updateChart(SWTChartEditor.this.chart); SWTChartEditor.this.shell.dispose(); } }); }
From source file:MainClass.java
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); new Label(composite, SWT.LEFT).setText("First Name:"); final Text first = new Text(composite, SWT.BORDER); first.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(composite, SWT.LEFT).setText("Last Name:"); final Text last = new Text(composite, SWT.BORDER); last.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); first.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { firstName = first.getText(); setPageComplete(firstName.length() > 0 && lastName.length() > 0); }/*from w w w .ja v a2s. c o m*/ }); last.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { lastName = last.getText(); setPageComplete(firstName.length() > 0 && lastName.length() > 0); } }); setControl(composite); }
From source file:org.eclipse.swt.examples.layoutexample.StackLayoutTab.java
@Override void createLayoutComposite() { layoutComposite = new Composite(layoutGroup, SWT.BORDER); layoutComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); createLayout();/*from w w w . j a v a 2s . c om*/ }