Example usage for org.eclipse.swt.widgets Composite setSize

List of usage examples for org.eclipse.swt.widgets Composite setSize

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Composite setSize.

Prototype

public void setSize(int width, int height) 

Source Link

Document

Sets the receiver's size to the point specified by the arguments.

Usage

From source file:org.jfree.experimental.chart.swt.editor.SWTChartEditorDialog.java

/**
 * Creates a new editor.//from   www  .j av a2s. c  om
 * 
 * @param shell2 the display.
 * @param chart2edit the chart to edit.
 */
public SWTChartEditorDialog(Shell shell2, final JFreeChart chart2edit) {

    this.dialog = new Dialog(shell2) {
        @Override
        protected Control createDialogArea(Composite parent) {
            SWTChartEditorDialog.this.chart = chart2edit;
            GridLayout layout = new GridLayout(2, true);
            layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 5;
            parent.setLayout(layout);

            Composite main = new Composite(parent, SWT.NONE);
            main.setLayout(new FillLayout());
            main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
            main.setSize(400, 500);

            TabFolder tab = new TabFolder(main, SWT.BORDER);
            // build first tab
            TabItem item1 = new TabItem(tab, SWT.NONE);
            item1.setText(" " + localizationResources.getString("Title") + " ");
            SWTChartEditorDialog.this.titleEditor = new SWTTitleEditor(tab, SWT.NONE,
                    SWTChartEditorDialog.this.chart.getTitle());
            item1.setControl(SWTChartEditorDialog.this.titleEditor);
            // build second tab
            TabItem item2 = new TabItem(tab, SWT.NONE);
            item2.setText(" " + localizationResources.getString("Plot") + " ");
            SWTChartEditorDialog.this.plotEditor = new SWTPlotEditor(tab, SWT.NONE,
                    SWTChartEditorDialog.this.chart.getPlot());
            item2.setControl(SWTChartEditorDialog.this.plotEditor);
            // build the third tab
            TabItem item3 = new TabItem(tab, SWT.NONE);
            item3.setText(" " + localizationResources.getString("Other") + " ");
            SWTChartEditorDialog.this.otherEditor = new SWTOtherEditor(tab, SWT.NONE,
                    SWTChartEditorDialog.this.chart);
            item3.setControl(SWTChartEditorDialog.this.otherEditor);

            return super.createDialogArea(parent);
        }

        @Override
        protected void buttonPressed(int buttonId) {
            if (buttonId == 0) {
                updateChart(SWTChartEditorDialog.this.chart);
            }
            this.close();
        }
    };

}