Example usage for org.eclipse.swt.widgets Label Label

List of usage examples for org.eclipse.swt.widgets Label Label

Introduction

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

Prototype

public Label(Composite parent, int style) 

Source Link

Document

Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

Usage

From source file:Survey.java

/**
 * Creates the controls for this page// www. ja  va 2 s.c  o  m
 */
public void createControl(Composite parent) {
    Label label = new Label(parent, SWT.CENTER);
    label.setText("Thanks!");
    setControl(label);
}

From source file:eu.stratosphere.addons.visualization.swt.SWTGateToolTip.java

public SWTGateToolTip(Shell parent, ManagementGate managementGate, int x, int y) {
    super(parent, x, y);

    int height;/*from  w  ww  . j av a  2  s .c om*/

    this.managementGate = managementGate;

    if (managementGate.isInputGate()) {
        setTitle("Input Gate " + managementGate.getIndex());
    } else {
        setTitle("Output Gate " + managementGate.getIndex());
    }

    final Color backgroundColor = getShell().getBackground();
    final Color foregroundColor = getShell().getForeground();

    final GateVisualizationData gateVisualizationData = (GateVisualizationData) managementGate.getAttachment();

    if (gateVisualizationData.isProfilingEnabled()) {
        this.chart = createChart(gateVisualizationData, backgroundColor);
        this.chart.setLayoutData(new GridData(GridData.FILL_BOTH));
        height = 200;
    } else {
        this.chart = null;
        height = 100;
    }

    final Composite tableComposite = new Composite(getShell(), SWT.NONE);
    tableComposite.setBackground(backgroundColor);
    tableComposite.setForeground(foregroundColor);

    final GridLayout tableGridLayout = new GridLayout(2, false);
    tableGridLayout.marginHeight = 0;
    tableGridLayout.marginLeft = 0;
    tableComposite.setLayout(tableGridLayout);

    // Channel type
    ChannelType channelType;
    if (managementGate.isInputGate()) {
        channelType = managementGate.getVertex().getGroupVertex().getBackwardEdge(managementGate.getIndex())
                .getChannelType();
    } else {
        channelType = managementGate.getVertex().getGroupVertex().getForwardEdge(managementGate.getIndex())
                .getChannelType();
    }

    final Label channelTypeTextLabel = new Label(tableComposite, SWT.NONE);
    channelTypeTextLabel.setBackground(backgroundColor);
    channelTypeTextLabel.setForeground(foregroundColor);
    channelTypeTextLabel.setText("Channel type:");

    this.channelTypeLabel = new Label(tableComposite, SWT.NONE);
    this.channelTypeLabel.setBackground(backgroundColor);
    this.channelTypeLabel.setForeground(foregroundColor);
    this.channelTypeLabel.setText(channelType.toString());

    if (!this.managementGate.isInputGate()) {
        final ManagementGroupEdge groupEdge = this.managementGate.getVertex().getGroupVertex()
                .getForwardEdge(this.managementGate.getIndex());
        final GroupEdgeVisualizationData groupEdgeVisualizationData = (GroupEdgeVisualizationData) groupEdge
                .getAttachment();

        if (groupEdgeVisualizationData.isIOBottleneck()) {
            this.warningComposite = createWarningComposite(WARNINGTEXT, SWT.ICON_WARNING);
            height += ICONSIZE;
        } else {
            this.warningComposite = null;
        }
    } else {
        this.warningComposite = null;
    }

    getShell().setSize(WIDTH, height);

    finishInstantiation(x, y, WIDTH, false);
}

From source file:com.rcp.wbw.demo.editor.SWTOtherEditor.java

/**
 * Creates a new instance.//from w ww . j  a v  a 2  s  .c om
 * 
 * @param parent
 *            the parent.
 * @param style
 *            the style.
 * @param chart
 *            the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString("Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    // row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString("Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    selectBgPaint.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            ColorDialog dlg = new ColorDialog(getShell());
            dlg.setText(localizationResources.getString("Background_paint"));
            dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas.getColor().getRGB());
            RGB rgb = dlg.open();
            if (rgb != null) {
                SWTOtherEditor.this.backgroundPaintCanvas.setColor(new Color(getDisplay(), rgb));
            }
        }
    });
}

From source file:ClipboardExample.java

public void open(Display display) {
    clipboard = new Clipboard(display);
    shell = new Shell(display);
    shell.setText("SWT Clipboard");
    shell.setLayout(new FillLayout());

    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
    Composite parent = new Composite(sc, SWT.NONE);
    sc.setContent(parent);//  w  ww. j a  v  a 2 s .  c o m
    parent.setLayout(new GridLayout(2, true));

    Group copyGroup = new Group(parent, SWT.NONE);
    copyGroup.setText("Copy From:");
    GridData data = new GridData(GridData.FILL_BOTH);
    copyGroup.setLayoutData(data);
    copyGroup.setLayout(new GridLayout(3, false));

    Group pasteGroup = new Group(parent, SWT.NONE);
    pasteGroup.setText("Paste To:");
    data = new GridData(GridData.FILL_BOTH);
    pasteGroup.setLayoutData(data);
    pasteGroup.setLayout(new GridLayout(3, false));

    Group controlGroup = new Group(parent, SWT.NONE);
    controlGroup.setText("Control API:");
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    controlGroup.setLayoutData(data);
    controlGroup.setLayout(new GridLayout(5, false));

    Group typesGroup = new Group(parent, SWT.NONE);
    typesGroup.setText("Available Types");
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    typesGroup.setLayoutData(data);
    typesGroup.setLayout(new GridLayout(2, false));

    status = new Label(parent, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.heightHint = 60;
    status.setLayoutData(data);

    createTextTransfer(copyGroup, pasteGroup);
    createRTFTransfer(copyGroup, pasteGroup);
    createHTMLTransfer(copyGroup, pasteGroup);
    createFileTransfer(copyGroup, pasteGroup);
    createMyTransfer(copyGroup, pasteGroup);
    createControlTransfer(controlGroup);
    createAvailableTypes(typesGroup);

    sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);

    Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Rectangle monitorArea = shell.getMonitor().getClientArea();
    shell.setSize(Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20));
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    clipboard.dispose();
}

From source file:org.eclipse.swt.examples.layoutexample.StackLayoutTab.java

/**
 * Creates the control widgets./*from   ww w . ja  va 2 s. c o  m*/
 */
@Override
void createControlWidgets() {
    /* Controls the topControl in the StackLayout */
    Group columnGroup = new Group(controlGroup, SWT.NONE);
    columnGroup.setText("topControl");//(LayoutExample.getResourceString ("Top_Control"));
    columnGroup.setLayout(new GridLayout(3, false));
    columnGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    backButton = new Button(columnGroup, SWT.PUSH);
    backButton.setText("<<");
    backButton.setEnabled(false);
    backButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
    backButton.addSelectionListener(
            SelectionListener.widgetSelectedAdapter(e -> setTopControl(currentLayer - 1)));
    topControl = new Label(columnGroup, SWT.BORDER);
    topControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    advanceButton = new Button(columnGroup, SWT.PUSH);
    advanceButton.setText(">>");
    advanceButton.setEnabled(false);
    advanceButton.addSelectionListener(
            SelectionListener.widgetSelectedAdapter(e -> setTopControl(currentLayer + 1)));

    /* Controls the margins of the StackLayout */
    Group marginGroup = new Group(controlGroup, SWT.NONE);
    marginGroup.setText(LayoutExample.getResourceString("Margins"));
    marginGroup.setLayout(new GridLayout(2, false));
    marginGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    new Label(marginGroup, SWT.NONE).setText("marginWidth");
    marginWidth = new Spinner(marginGroup, SWT.BORDER);
    marginWidth.setSelection(0);
    marginWidth.addSelectionListener(selectionListener);
    new Label(marginGroup, SWT.NONE).setText("marginHeight");
    marginHeight = new Spinner(marginGroup, SWT.BORDER);
    marginHeight.setSelection(0);
    marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    marginHeight.addSelectionListener(selectionListener);

    /* Add common controls */
    super.createControlWidgets();
}

From source file:at.ac.tuwien.inso.subcat.ui.widgets.TimeChartControlPanel.java

public TimeChartControlPanel(Composite parent, int style) {
    super(parent, SWT.NONE);
    setLayout(new GridLayout(3, false));

    Composite composite = new Composite(this, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
    GridLayout gl_composite = new GridLayout(3, false);
    gl_composite.verticalSpacing = 0;/*w w w .ja  va  2 s  .  c o m*/
    gl_composite.marginWidth = 0;
    gl_composite.marginHeight = 0;
    gl_composite.horizontalSpacing = 0;
    composite.setLayout(gl_composite);

    // Chart, Top Panel:
    new Label(composite, SWT.NONE);
    ;

    Composite chartTopComposite = new Composite(composite, SWT.NONE);
    GridLayout chartBottomLayout = new GridLayout(3, true);
    chartTopComposite.setLayout(chartBottomLayout);
    chartBottomLayout.verticalSpacing = 0;
    chartBottomLayout.marginWidth = 0;
    chartBottomLayout.marginHeight = 0;
    chartBottomLayout.horizontalSpacing = 0;

    chartTopComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
    yearSelector = new Combo(chartTopComposite, SWT.READ_ONLY);

    chartTopComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    chartSelector = new Combo(chartTopComposite, SWT.READ_ONLY);
    chartSelector.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));

    chartTopComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    Button saveButton = new Button(chartTopComposite, SWT.NONE);
    saveButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
    saveButton.setText("Save");

    new Label(composite, SWT.NONE);

    // Chart Row:
    btnPrev = new Button(composite, SWT.NONE);
    btnPrev.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    btnPrev.setText("<");

    // TODO: drop scrolledComposite 
    scrolledComposite = new ScrolledComposite(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setLayout(new FillLayout());

    chartComposite = new ChartComposite(scrolledComposite, SWT.NONE, null);
    chartComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    chartComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
    scrolledComposite.setContent(chartComposite);

    btnNext = new Button(composite, SWT.NONE);
    btnNext.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    btnNext.setText(">");

    // ** Event handling:

    chartSelector.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            for (TimeChartControlPanelListener listener : listeners) {
                listener.chartSelectionChanged();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    // *** Year Setting:
    yearSelector.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            btnPrev.setEnabled(hasPrevChart());
            btnNext.setEnabled(hasNextChart());

            triggerChartSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    btnPrev.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            yearSelector.select(yearSelector.getSelectionIndex() - 1);
            btnPrev.setEnabled(hasPrevChart());
            btnNext.setEnabled(hasNextChart());

            triggerChartSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    btnNext.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            yearSelector.select(yearSelector.getSelectionIndex() + 1);
            btnPrev.setEnabled(hasPrevChart());
            btnNext.setEnabled(hasNextChart());

            triggerChartSelected();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    saveButton.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog fd = new FileDialog(TimeChartControlPanel.this.getShell(), SWT.SAVE);
            fd.setText("Save Chart");
            String[] filterExt = { "*.png", "*.jpg" };
            fd.setFilterExtensions(filterExt);
            String selectedPath = fd.open();
            if (selectedPath == null) {
                return;
            }

            for (TimeChartControlPanelListener listener : listeners) {
                listener.chartSaveRequest(selectedPath);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}

From source file:org.eclipse.swt.examples.layoutexample.FillLayoutTab.java

/**
 * Creates the control widgets./* w  w  w . j av  a 2 s .c o m*/
 */
@Override
void createControlWidgets() {
    /* Controls the type of FillLayout */
    Group typeGroup = new Group(controlGroup, SWT.NONE);
    typeGroup.setText(LayoutExample.getResourceString("Type"));
    typeGroup.setLayout(new GridLayout());
    typeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    horizontal = new Button(typeGroup, SWT.RADIO);
    horizontal.setText("SWT.HORIZONTAL");
    horizontal.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    horizontal.setSelection(true);
    horizontal.addSelectionListener(selectionListener);
    vertical = new Button(typeGroup, SWT.RADIO);
    vertical.setText("SWT.VERTICAL");
    vertical.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    vertical.addSelectionListener(selectionListener);

    /* Controls the margins and spacing of the FillLayout */
    Group marginGroup = new Group(controlGroup, SWT.NONE);
    marginGroup.setText(LayoutExample.getResourceString("Margins_Spacing"));
    marginGroup.setLayout(new GridLayout(2, false));
    marginGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    new Label(marginGroup, SWT.NONE).setText("marginWidth");
    marginWidth = new Spinner(marginGroup, SWT.BORDER);
    marginWidth.setSelection(0);
    marginWidth.addSelectionListener(selectionListener);
    new Label(marginGroup, SWT.NONE).setText("marginHeight");
    marginHeight = new Spinner(marginGroup, SWT.BORDER);
    marginHeight.setSelection(0);
    marginHeight.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    marginHeight.addSelectionListener(selectionListener);
    new Label(marginGroup, SWT.NONE).setText("spacing");
    spacing = new Spinner(marginGroup, SWT.BORDER);
    spacing.setSelection(0);
    spacing.addSelectionListener(selectionListener);

    /* Add common controls */
    super.createControlWidgets();
}

From source file:org.eclipse.swt.examples.graphics.GradientDialog.java

/**
 * Creates the controls of the dialog./*from  ww w  .ja  v a 2 s . co  m*/
 * */
public void createDialogControls(final Shell parent) {
    final Display display = parent.getDisplay();

    // message
    Label message = new Label(parent, SWT.NONE);
    message.setText(GraphicsExample.getResourceString("GradientDlgMsg"));
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    message.setLayoutData(gridData);

    // default colors are white and black
    if (rgb1 == null || rgb2 == null) {
        rgb1 = display.getSystemColor(SWT.COLOR_WHITE).getRGB();
        rgb2 = display.getSystemColor(SWT.COLOR_BLACK).getRGB();
    }

    // canvas
    canvas = new Canvas(parent, SWT.NONE);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = 200;
    gridData.heightHint = 100;
    canvas.setLayoutData(gridData);
    canvas.addListener(SWT.Paint, e -> {
        Image preview = null;
        Point size = canvas.getSize();
        Color color1 = new Color(display, rgb1);
        Color color2 = new Color(display, rgb2);
        preview = GraphicsExample.createImage(display, color1, color2, size.x, size.y);
        if (preview != null) {
            e.gc.drawImage(preview, 0, 0);
        }
        preview.dispose();
        color1.dispose();
        color2.dispose();
    });

    // composite used for both color buttons
    Composite colorButtonComp = new Composite(parent, SWT.NONE);

    // layout buttons
    RowLayout layout = new RowLayout();
    layout.type = SWT.VERTICAL;
    layout.pack = false;
    colorButtonComp.setLayout(layout);

    // position composite
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    colorButtonComp.setLayoutData(gridData);

    ColorMenu colorMenu = new ColorMenu();

    // color controls: first color
    colorButton1 = new Button(colorButtonComp, SWT.PUSH);
    colorButton1.setText(GraphicsExample.getResourceString("GradientDlgButton1"));
    Color color1 = new Color(display, rgb1);
    Image img1 = GraphicsExample.createImage(display, color1);
    color1.dispose();
    colorButton1.setImage(img1);
    resources.add(img1);
    menu1 = colorMenu.createMenu(parent.getParent(), gb -> {
        rgb1 = gb.getBgColor1().getRGB();
        colorButton1.setImage(gb.getThumbNail());
        if (canvas != null)
            canvas.redraw();
    });
    colorButton1.addListener(SWT.Selection, event -> {
        final Button button = (Button) event.widget;
        final Composite parent1 = button.getParent();
        Rectangle bounds = button.getBounds();
        Point point = parent1.toDisplay(new Point(bounds.x, bounds.y));
        menu1.setLocation(point.x, point.y + bounds.height);
        menu1.setVisible(true);
    });

    // color controls: second color
    colorButton2 = new Button(colorButtonComp, SWT.PUSH);
    colorButton2.setText(GraphicsExample.getResourceString("GradientDlgButton2"));
    Color color2 = new Color(display, rgb2);
    Image img2 = GraphicsExample.createImage(display, color2);
    color2.dispose();
    colorButton2.setImage(img2);
    resources.add(img2);
    menu2 = colorMenu.createMenu(parent.getParent(), gb -> {
        rgb2 = gb.getBgColor1().getRGB();
        colorButton2.setImage(gb.getThumbNail());
        if (canvas != null)
            canvas.redraw();
    });
    colorButton2.addListener(SWT.Selection, event -> {
        final Button button = (Button) event.widget;
        final Composite parent1 = button.getParent();
        Rectangle bounds = button.getBounds();
        Point point = parent1.toDisplay(new Point(bounds.x, bounds.y));
        menu2.setLocation(point.x, point.y + bounds.height);
        menu2.setVisible(true);
    });

    // composite used for ok and cancel buttons
    Composite okCancelComp = new Composite(parent, SWT.NONE);

    // layout buttons
    RowLayout rowLayout = new RowLayout();
    rowLayout.pack = false;
    rowLayout.marginTop = 5;
    okCancelComp.setLayout(rowLayout);

    // position composite
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gridData.horizontalSpan = 2;
    okCancelComp.setLayoutData(gridData);

    // OK button
    okButton = new Button(okCancelComp, SWT.PUSH);
    okButton.setText("&OK");
    okButton.addListener(SWT.Selection, event -> {
        returnVal = SWT.OK;
        parent.close();
    });

    // cancel button
    cancelButton = new Button(okCancelComp, SWT.PUSH);
    cancelButton.setText("&Cancel");
    cancelButton.addListener(SWT.Selection, event -> parent.close());
}

From source file:ProgressBarDialog.java

protected void createContents() {
    shell = new Shell(getParent(), SWT.TITLE | SWT.PRIMARY_MODAL);
    display = shell.getDisplay();//from w w  w  .j  a v  a 2s . c o m
    final GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 10;

    shell.setLayout(gridLayout);
    shell.setSize(483, 181);
    shell.setText(shellTitle);

    final Composite composite = new Composite(shell, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    composite.setLayout(new GridLayout());

    message = new CLabel(composite, SWT.NONE);
    message.setImage(processImage);
    message.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    message.setText(processMessage);

    progressBarComposite = new Composite(shell, SWT.NONE);
    progressBarComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
    progressBarComposite.setLayout(new FillLayout());

    progressBar = new ProgressBar(progressBarComposite, processBarStyle);
    progressBar.setMaximum(executeTime);

    processMessageLabel = new Label(shell, SWT.NONE);
    processMessageLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
    lineLabel = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
    lineLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));

    cancelComposite = new Composite(shell, SWT.NONE);
    cancelComposite.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
    final GridLayout gridLayout_1 = new GridLayout();
    gridLayout_1.numColumns = 2;
    cancelComposite.setLayout(gridLayout_1);

    cancelButton = new Button(cancelComposite, SWT.NONE);
    cancelButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            isClosed = true;
            //System.out.println(isClosed);
        }
    });
    cancelButton.setLayoutData(new GridData(78, SWT.DEFAULT));
    cancelButton.setText("cancel");
    cancelButton.setEnabled(this.mayCancel);

}

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

/**
 * Creates a new editor.//from  ww  w . j av a 2 s  . com
 * 
 * @param parent  the parent.
 * @param style  the style.
 * @param axis  the axis.
 */
public SWTNumberAxisEditor(Composite parent, int style, NumberAxis axis) {
    super(parent, style, axis);
    this.autoRange = axis.isAutoRange();
    this.minimumValue = axis.getLowerBound();
    this.maximumValue = axis.getUpperBound();

    TabItem item2 = new TabItem(getOtherTabs(), SWT.NONE);
    item2.setText(" " + localizationResources.getString("Range") + " ");
    Composite range = new Composite(getOtherTabs(), SWT.NONE);
    range.setLayout(new GridLayout(2, true));
    item2.setControl(range);

    this.autoRangeCheckBox = new Button(range, SWT.CHECK);
    this.autoRangeCheckBox.setText(localizationResources.getString("Auto-adjust_range"));
    this.autoRangeCheckBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    this.autoRangeCheckBox.setSelection(this.autoRange);
    this.autoRangeCheckBox.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            toggleAutoRange();
        }
    });
    new Label(range, SWT.NONE).setText(localizationResources.getString("Minimum_range_value"));
    this.minimumRangeValue = new Text(range, SWT.BORDER);
    this.minimumRangeValue.setText(String.valueOf(this.minimumValue));
    this.minimumRangeValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    this.minimumRangeValue.setEnabled(!this.autoRange);
    //this.minimumRangeValue.addModifyListener(this);
    //this.minimumRangeValue.addVerifyListener(this);
    this.minimumRangeValue.addFocusListener(this);
    new Label(range, SWT.NONE).setText(localizationResources.getString("Maximum_range_value"));
    this.maximumRangeValue = new Text(range, SWT.BORDER);
    this.maximumRangeValue.setText(String.valueOf(this.maximumValue));
    this.maximumRangeValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    this.maximumRangeValue.setEnabled(!this.autoRange);
    //this.maximumRangeValue.addModifyListener(this);
    //this.maximumRangeValue.addVerifyListener(this);
    this.maximumRangeValue.addFocusListener(this);
}