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:LayoutExample.java

/**
 * Creates the control widgets./*w ww.  j a va2  s  .co  m*/
 */
void createControlWidgets() {
    /* Controls the margins and spacing of the FormLayout */
    String[] marginValues = new String[] { "0", "3", "5", "10" };
    Group marginGroup = new Group(controlGroup, SWT.NONE);
    marginGroup.setText(LayoutExample.getResourceString("Margins"));
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    marginGroup.setLayout(layout);
    marginGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(marginGroup, SWT.NONE).setText("marginHeight");
    marginHeight = new Combo(marginGroup, SWT.NONE);
    marginHeight.setItems(marginValues);
    marginHeight.select(0);
    marginHeight.addSelectionListener(selectionListener);
    marginHeight.addTraverseListener(traverseListener);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 60;
    marginHeight.setLayoutData(data);
    new Label(marginGroup, SWT.NONE).setText("marginWidth");
    marginWidth = new Combo(marginGroup, SWT.NONE);
    marginWidth.setItems(marginValues);
    marginWidth.select(0);
    marginWidth.addSelectionListener(selectionListener);
    marginWidth.addTraverseListener(traverseListener);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 60;
    marginWidth.setLayoutData(data);

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

    /* Position the sash */
    sash.setWeights(new int[] { 6, 4 });
}

From source file:org.eclipse.swt.examples.imageanalyzer.ImageAnalyzer.java

int showBMPDialog() {
    final int[] bmpType = new int[1];
    bmpType[0] = SWT.IMAGE_BMP;//from w  ww .  j  av a 2s . com
    SelectionListener radioSelected = widgetSelectedAdapter(event -> {
        Button radio = (Button) event.widget;
        if (radio.getSelection())
            bmpType[0] = ((Integer) radio.getData()).intValue();
    });
    // need to externalize strings
    final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);

    dialog.setText(bundle.getString("Save_as_type"));
    dialog.setLayout(new GridLayout());

    Label label = new Label(dialog, SWT.NONE);
    label.setText(bundle.getString("Save_as_type_label"));

    Button radio = new Button(dialog, SWT.RADIO);
    radio.setText(bundle.getString("Save_as_type_no_compress"));
    radio.setSelection(true);
    radio.setData(Integer.valueOf(SWT.IMAGE_BMP));
    radio.addSelectionListener(radioSelected);

    radio = new Button(dialog, SWT.RADIO);
    radio.setText(bundle.getString("Save_as_type_rle_compress"));
    radio.setData(Integer.valueOf(SWT.IMAGE_BMP_RLE));
    radio.addSelectionListener(radioSelected);

    radio = new Button(dialog, SWT.RADIO);
    radio.setText(bundle.getString("Save_as_type_os2"));
    radio.setData(Integer.valueOf(SWT.IMAGE_OS2_BMP));
    radio.addSelectionListener(radioSelected);

    label = new Label(dialog, SWT.SEPARATOR | SWT.HORIZONTAL);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Button ok = new Button(dialog, SWT.PUSH);
    ok.setText(bundle.getString("OK"));
    GridData data = new GridData();
    data.horizontalAlignment = SWT.CENTER;
    data.widthHint = 75;
    ok.setLayoutData(data);
    ok.addSelectionListener(widgetSelectedAdapter(e -> dialog.close()));

    dialog.pack();
    dialog.open();
    while (!dialog.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    return bmpType[0];
}

From source file:PrintKTableExample.java

protected void createContents() {
    guiMainArea.setLayout(new FillLayout());
    root = new Composite(guiMainArea, SWT.NONE);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.verticalSpacing = 10;//from w ww . ja  va  2s.co  m
    gridLayout.numColumns = 2;
    root.setLayout(gridLayout);

    {
        final Label l = new Label(root, SWT.NONE);
        l.setText("Papierformat:");
        final GridData gridData_2 = new GridData();
        gridData_2.widthHint = 80;
        l.setLayoutData(gridData_2);
    }
    {
        combFormat = new Combo(root, SWT.BORDER | SWT.READ_ONLY);
        combFormat.setToolTipText(
                "Bestimmt die PapiergroBe. Diese muss mit der Druckereinstellung ubereinstimmen.");
        for (int i = 0; i < formatNames.length; i++) {
            combFormat.add(formatNames[i]);
        }
        combFormat.setText(format);

        final GridData gridData_1 = new GridData(GridData.FILL_HORIZONTAL);
        gridData_1.widthHint = 180;
        combFormat.setLayoutData(gridData_1);
    }
    {
        final Label label = new Label(root, SWT.NONE);
        label.setText("Seitenrander:");
        label.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    {
        cmbMargin = new Combo(root, SWT.READ_ONLY);
        cmbMargin.setToolTipText("Bestimmt die Breite der Rander.");
        cmbMargin.add("Schmale Rander");
        cmbMargin.add("Normale Rander");
        cmbMargin.add("Breite Rander");
        cmbMargin.select(marginStyle);
        cmbMargin.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    {
        final Label label = new Label(root, SWT.NONE);
        final GridData gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
        gridData.horizontalSpan = 1;
        label.setLayoutData(gridData);
        label.setText("Ausrichtung:");
    }
    {
        butPortrait = new Button(root, SWT.RADIO);
        butPortrait.setToolTipText(
                "Bestimmt, ob das Papier hochkant oder Breit bedruckt werden soll. \nDiese Einstellung muss mit der des Druckers ubereinstimmen");
        butPortrait.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
        butPortrait.setText("Hochformat");
        butPortrait.setSelection(portrait);
    }
    {
        final Label label = new Label(root, SWT.NONE);
    }
    {
        butLandscape = new Button(root, SWT.RADIO);
        butLandscape.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
        butLandscape.setText("Breitformat");
        butLandscape.setSelection(!portrait);
        butLandscape.setToolTipText(
                "Bestimmt, ob das Papier hochkant oder quer bedruckt werden soll. \nDiese Einstellung muss mit der des Druckers ubereinstimmen");
    }
    {
        final Label label = new Label(root, SWT.NONE);
        label.setText("Skalierung:");
        label.setLayoutData(new GridData(GridData.FILL_BOTH));
    }
    {
        cmbScalierung = new Combo(root, SWT.READ_ONLY);
        cmbScalierung.setItems(scalings);
        cmbScalierung.select(10 - (scaling / 10));
        cmbScalierung.setLayoutData(new GridData(GridData.FILL_BOTH));
        cmbScalierung.setToolTipText(
                "Hiermit konnen Sie dir GroBe des Ausdrucks veringern, so daB mehr auf eine Seite passt.");
    }

}

From source file:CustomControlExample.java

/**
 * Creates the "Colors" group.//from w  w  w .j a v  a 2s  .  com
 */
void createColorGroup() {
    super.createColorGroup();

    itemGroup = new Group(colorGroup, SWT.NONE);
    itemGroup.setText(ControlExample.getResourceString("Table_Item_Colors"));
    GridData data = new GridData();
    data.horizontalSpan = 2;
    itemGroup.setLayoutData(data);
    itemGroup.setLayout(new GridLayout(2, false));
    new Label(itemGroup, SWT.NONE).setText(ControlExample.getResourceString("Foreground_Color"));
    itemForegroundButton = new Button(itemGroup, SWT.PUSH);
    new Label(itemGroup, SWT.NONE).setText(ControlExample.getResourceString("Background_Color"));
    itemBackgroundButton = new Button(itemGroup, SWT.PUSH);
    itemFontButton = new Button(itemGroup, SWT.PUSH);
    itemFontButton.setText(ControlExample.getResourceString("Font"));
    itemFontButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    Shell shell = colorGroup.getShell();
    final ColorDialog foregroundDialog = new ColorDialog(shell);
    final ColorDialog backgroundDialog = new ColorDialog(shell);
    final FontDialog fontDialog = new FontDialog(shell);

    int imageSize = 12;
    Display display = shell.getDisplay();
    itemForegroundImage = new Image(display, imageSize, imageSize);
    itemBackgroundImage = new Image(display, imageSize, imageSize);

    /* Add listeners to set the colors and font */
    itemForegroundButton.setImage(itemForegroundImage);
    itemForegroundButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            Color oldColor = itemForegroundColor;
            if (oldColor == null)
                oldColor = table1.getItem(0).getForeground();
            foregroundDialog.setRGB(oldColor.getRGB());
            RGB rgb = foregroundDialog.open();
            if (rgb == null)
                return;
            oldColor = itemForegroundColor;
            itemForegroundColor = new Color(event.display, rgb);
            setItemForeground();
            if (oldColor != null)
                oldColor.dispose();
        }
    });
    itemBackgroundButton.setImage(itemBackgroundImage);
    itemBackgroundButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            Color oldColor = itemBackgroundColor;
            if (oldColor == null)
                oldColor = table1.getItem(0).getBackground();
            backgroundDialog.setRGB(oldColor.getRGB());
            RGB rgb = backgroundDialog.open();
            if (rgb == null)
                return;
            oldColor = itemBackgroundColor;
            itemBackgroundColor = new Color(event.display, rgb);
            setItemBackground();
            if (oldColor != null)
                oldColor.dispose();
        }
    });
    itemFontButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            Font oldFont = itemFont;
            if (oldFont == null)
                oldFont = table1.getItem(0).getFont();
            fontDialog.setFontList(oldFont.getFontData());
            FontData fontData = fontDialog.open();
            if (fontData == null)
                return;
            oldFont = itemFont;
            itemFont = new Font(event.display, fontData);
            setItemFont();
            setExampleWidgetSize();
            if (oldFont != null)
                oldFont.dispose();
        }
    });
    shell.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            if (itemBackgroundImage != null)
                itemBackgroundImage.dispose();
            if (itemForegroundImage != null)
                itemForegroundImage.dispose();
            if (itemBackgroundColor != null)
                itemBackgroundColor.dispose();
            if (itemForegroundColor != null)
                itemForegroundColor.dispose();
            if (itemFont != null)
                itemFont.dispose();
            itemBackgroundColor = null;
            itemForegroundColor = null;
            itemFont = null;
        }
    });
}

From source file:PrintKTableExample.java

public MsgBox(Display d, String title, String message, String buttons) {
    this.d = d;//from   ww w.j  ava 2s . c  o  m
    this.s = new Shell(d, SWT.TITLE | SWT.APPLICATION_MODAL);
    this.s.setText(title);
    additionalControl = null;
    ende = false;

    FormLayout fl = new FormLayout();
    this.s.setLayout(fl);

    bild = new Label(this.s, SWT.LEFT);
    bild.setImage(IconSource.getImage("MsgBox"));
    bild.setBackground(d.getSystemColor(SWT.COLOR_WHITE));

    FormData f = new FormData();
    f.top = new FormAttachment(0, 0);
    f.left = new FormAttachment(0, 0);
    f.bottom = new FormAttachment(100, 0);
    bild.setLayoutData(f);

    Label separator = new Label(this.s, SWT.SEPARATOR);

    f = new FormData();
    f.top = new FormAttachment(0, 0);
    f.left = new FormAttachment(bild, 0);
    f.bottom = new FormAttachment(100, 0);
    separator.setLayoutData(f);

    meldung = new Label(s, SWT.LEFT | SWT.WRAP);
    meldung.setText(message);

    f = new FormData();
    f.top = new FormAttachment(0, 25);
    f.left = new FormAttachment(bild, 25);
    f.right = new FormAttachment(100, -25);
    f.bottom = new FormAttachment(100, -55);
    meldung.setLayoutData(f);

    ButtonBar butBar = new ButtonBar(s, 80);
    StringTokenizer t = new StringTokenizer(buttons, ",");
    boolean first = true;
    while (t.hasMoreTokens()) {
        Button but = butBar.addButton(t.nextToken(), "", new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                pressedButton = ((Button) e.getSource()).getText();
                ende = true;
            }
        });
        if (first) {
            first = false;
            s.setDefaultButton(but);
        }
    }
    f = new FormData();
    f.bottom = new FormAttachment(100, -4);
    f.left = new FormAttachment(bild, 15);
    f.right = new FormAttachment(100, -15);
    butBar.setLayoutData(f);

}

From source file:PrintKTableExample.java

protected void createButtonBar() {
    // AuBeres Composite
    guiButtonArea = new Composite(guiShell, SWT.NONE);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    guiButtonArea.setLayoutData(gd);//from  w  w w .  j av a2 s. c om

    FormLayout butLayout = new FormLayout();
    guiButtonArea.setLayout(butLayout);

    // Trennlinie
    Label sep = new Label(guiButtonArea, SWT.SEPARATOR | SWT.HORIZONTAL);
    FormData fd = new FormData();
    fd.bottom = new FormAttachment(100, -32);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    sep.setLayoutData(fd);

}

From source file:CustomControlExample.java

/**
 * Creates the "StyledText Style" group.
 *///  w w w . j  a  v  a  2  s  .co m
void createStyledTextStyleGroup() {
    final Display display = controlGroup.getDisplay();
    styledTextStyleGroup = new Group(controlGroup, SWT.NONE);
    styledTextStyleGroup.setText(ControlExample.getResourceString("StyledText_Styles"));
    styledTextStyleGroup.setLayout(new GridLayout(7, false));
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data.horizontalSpan = 2;
    styledTextStyleGroup.setLayoutData(data);

    /* Get images */
    boldImage = createBitmapImage(display, "bold");
    italicImage = createBitmapImage(display, "italic");
    redImage = createBitmapImage(display, "red");
    yellowImage = createBitmapImage(display, "yellow");
    underlineImage = createBitmapImage(display, "underline");
    strikeoutImage = createBitmapImage(display, "strikeout");

    /* Create controls to modify the StyledText */
    Label label = new Label(styledTextStyleGroup, SWT.NONE);
    label.setText(ControlExample.getResourceString("StyledText_Style_Instructions"));
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 7;
    label.setLayoutData(data);
    new Label(styledTextStyleGroup, SWT.NONE).setText(ControlExample.getResourceString("Bold"));
    boldButton = new Button(styledTextStyleGroup, SWT.PUSH);
    boldButton.setImage(boldImage);
    new Label(styledTextStyleGroup, SWT.NONE).setText(ControlExample.getResourceString("Underline"));
    underlineButton = new Button(styledTextStyleGroup, SWT.PUSH);
    underlineButton.setImage(underlineImage);
    new Label(styledTextStyleGroup, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(styledTextStyleGroup, SWT.NONE).setText(ControlExample.getResourceString("Foreground_Style"));
    redButton = new Button(styledTextStyleGroup, SWT.PUSH);
    redButton.setImage(redImage);
    new Label(styledTextStyleGroup, SWT.NONE).setText(ControlExample.getResourceString("Italic"));
    italicButton = new Button(styledTextStyleGroup, SWT.PUSH);
    italicButton.setImage(italicImage);
    new Label(styledTextStyleGroup, SWT.NONE).setText(ControlExample.getResourceString("Strikeout"));
    strikeoutButton = new Button(styledTextStyleGroup, SWT.PUSH);
    strikeoutButton.setImage(strikeoutImage);
    new Label(styledTextStyleGroup, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    new Label(styledTextStyleGroup, SWT.NONE).setText(ControlExample.getResourceString("Background_Style"));
    yellowButton = new Button(styledTextStyleGroup, SWT.PUSH);
    yellowButton.setImage(yellowImage);
    SelectionListener styleListener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Point sel = styledText.getSelectionRange();
            if ((sel == null) || (sel.y == 0))
                return;
            StyleRange style;
            for (int i = sel.x; i < sel.x + sel.y; i++) {
                StyleRange range = styledText.getStyleRangeAtOffset(i);
                if (range != null) {
                    style = (StyleRange) range.clone();
                    style.start = i;
                    style.length = 1;
                } else {
                    style = new StyleRange(i, 1, null, null, SWT.NORMAL);
                }
                if (e.widget == boldButton) {
                    style.fontStyle ^= SWT.BOLD;
                } else if (e.widget == italicButton) {
                    style.fontStyle ^= SWT.ITALIC;
                } else if (e.widget == underlineButton) {
                    style.underline = !style.underline;
                } else if (e.widget == strikeoutButton) {
                    style.strikeout = !style.strikeout;
                }
                styledText.setStyleRange(style);
            }
            styledText.setSelectionRange(sel.x + sel.y, 0);
        }
    };
    SelectionListener colorListener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Point sel = styledText.getSelectionRange();
            if ((sel == null) || (sel.y == 0))
                return;
            Color fg = null, bg = null;
            if (e.widget == redButton) {
                fg = display.getSystemColor(SWT.COLOR_RED);
            } else if (e.widget == yellowButton) {
                bg = display.getSystemColor(SWT.COLOR_YELLOW);
            }
            StyleRange style;
            for (int i = sel.x; i < sel.x + sel.y; i++) {
                StyleRange range = styledText.getStyleRangeAtOffset(i);
                if (range != null) {
                    style = (StyleRange) range.clone();
                    style.start = i;
                    style.length = 1;
                    style.foreground = style.foreground != null ? null : fg;
                    style.background = style.background != null ? null : bg;
                } else {
                    style = new StyleRange(i, 1, fg, bg, SWT.NORMAL);
                }
                styledText.setStyleRange(style);
            }
            styledText.setSelectionRange(sel.x + sel.y, 0);
        }
    };
    boldButton.addSelectionListener(styleListener);
    italicButton.addSelectionListener(styleListener);
    underlineButton.addSelectionListener(styleListener);
    strikeoutButton.addSelectionListener(styleListener);
    redButton.addSelectionListener(colorListener);
    yellowButton.addSelectionListener(colorListener);
    yellowButton.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            boldImage.dispose();
            italicImage.dispose();
            redImage.dispose();
            yellowImage.dispose();
            underlineImage.dispose();
            strikeoutImage.dispose();
        }
    });
}

From source file:PrintKTableExample.java

/**
 * Sets the image displayed in the dialogs header.
 * //w  ww  .  j  ava 2s  .c o m
 * @param image
 */
public void setDialogImage(Image image) {
    guiPictureArea.setBackground(guiDisplay.getSystemColor(SWT.COLOR_WHITE));

    guiPictureGridData.heightHint = image.getBounds().height + 2;

    GridLayout layout = new GridLayout(1, true);
    guiPictureArea.setLayout(layout);
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;

    guiPictureLabel = new Label(guiPictureArea, SWT.NONE);
    guiPictureLabel.setImage(image);
    // guiPictureLabel.setBackground(guiDisplay.getSystemColor(SWT.COLOR_WHITE));
    GridData gd = new GridData();
    // gd.grabExcessHorizontalSpace = true;
    // gd.horizontalAlignment = GridData.FILL;
    guiPictureLabel.setLayoutData(gd);

    Label line = new Label(guiPictureArea, SWT.SEPARATOR | SWT.HORIZONTAL);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = GridData.FILL;
    line.setLayoutData(gd);
}

From source file:PrintKTableExample.java

/**
 * Adds a ToolItem to the dialog's toolbar. Creates the toolbar if not
 * already done./*from   w w  w  . j  a  va2s  .c  o  m*/
 * 
 * @param name
 *            The name if the ToolItem. Although this name is never
 *            displayed to the user you can use it in onToolItem to identify
 *            the activated ToolItem.
 * @param tooltip
 *            The item's tooltip
 * @param icon
 *            The icon to show.
 * @return ToolItem The ToolItem created by this method.
 */
public ToolItem addToolItem(String name, String tooltip, Image icon) {
    if (guiToolBar == null) {
        FormLayout layout = new FormLayout();
        guiToolBarArea.setLayout(layout);
        // layout.horizontalSpacing = 0;
        // layout.verticalSpacing = 0;
        layout.marginHeight = 0;
        layout.marginWidth = 0;

        guiToolBar = new ToolBar(guiToolBarArea, SWT.FLAT);
        FormData fd = new FormData();
        fd.left = new FormAttachment(0, 0);
        fd.top = new FormAttachment(0, 0);
        guiToolBar.setLayoutData(fd);

        Label line = new Label(guiToolBarArea, SWT.SEPARATOR | SWT.HORIZONTAL);
        fd = new FormData();
        fd.left = new FormAttachment(0, 0);
        fd.top = new FormAttachment(guiToolBar, 1);
        fd.right = new FormAttachment(100, 0);
        line.setLayoutData(fd);

        guiLastToolControl = guiToolBar;

    }
    ToolItem ti = new ToolItem(guiToolBar, SWT.PUSH);
    ti.setImage(icon);
    ti.setToolTipText(tooltip);
    ti.setEnabled(true);
    ti.setData(name);
    ti.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            onToolItem((ToolItem) e.widget, (String) e.widget.getData());
        }
    });

    guiToolBarGridData.heightHint = guiToolBarArea.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    return ti;
}

From source file:CustomControlExample.java

/**
 * Creates the "Control" widget children.
 *//*from   w  ww.jav  a 2  s  .c o  m*/
void createControlWidgets() {

    /* Create the menu style buttons */
    barButton = new Button(styleGroup, SWT.CHECK);
    barButton.setText("SWT.BAR");
    dropDownButton = new Button(styleGroup, SWT.CHECK);
    dropDownButton.setText("SWT.DROP_DOWN");
    popUpButton = new Button(styleGroup, SWT.CHECK);
    popUpButton.setText("SWT.POP_UP");
    noRadioGroupButton = new Button(styleGroup, SWT.CHECK);
    noRadioGroupButton.setText("SWT.NO_RADIO_GROUP");
    leftToRightButton = new Button(styleGroup, SWT.RADIO);
    leftToRightButton.setText("SWT.LEFT_TO_RIGHT");
    leftToRightButton.setSelection(true);
    rightToLeftButton = new Button(styleGroup, SWT.RADIO);
    rightToLeftButton.setText("SWT.RIGHT_TO_LEFT");

    /* Create the menu item style buttons */
    cascadeButton = new Button(menuItemStyleGroup, SWT.CHECK);
    cascadeButton.setText("SWT.CASCADE");
    checkButton = new Button(menuItemStyleGroup, SWT.CHECK);
    checkButton.setText("SWT.CHECK");
    pushButton = new Button(menuItemStyleGroup, SWT.CHECK);
    pushButton.setText("SWT.PUSH");
    radioButton = new Button(menuItemStyleGroup, SWT.CHECK);
    radioButton.setText("SWT.RADIO");
    separatorButton = new Button(menuItemStyleGroup, SWT.CHECK);
    separatorButton.setText("SWT.SEPARATOR");

    /* Create the 'other' buttons */
    imagesButton = new Button(otherGroup, SWT.CHECK);
    imagesButton.setText(ControlExample.getResourceString("Images"));
    acceleratorsButton = new Button(otherGroup, SWT.CHECK);
    acceleratorsButton.setText(ControlExample.getResourceString("Accelerators"));
    mnemonicsButton = new Button(otherGroup, SWT.CHECK);
    mnemonicsButton.setText(ControlExample.getResourceString("Mnemonics"));
    subMenuButton = new Button(otherGroup, SWT.CHECK);
    subMenuButton.setText(ControlExample.getResourceString("SubMenu"));
    subSubMenuButton = new Button(otherGroup, SWT.CHECK);
    subSubMenuButton.setText(ControlExample.getResourceString("SubSubMenu"));

    /*
     * Create the "create" and "closeAll" buttons (and a 'filler' label to
     * place them)
     */
    new Label(controlGroup, SWT.NONE);
    createButton = new Button(controlGroup, SWT.NONE);
    createButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    createButton.setText(ControlExample.getResourceString("Create_Shell"));
    closeAllButton = new Button(controlGroup, SWT.NONE);
    closeAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    closeAllButton.setText(ControlExample.getResourceString("Close_All_Shells"));

    /* Add the listeners */
    createButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            createButtonSelected(e);
        }
    });
    closeAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            closeAllShells();
        }
    });
    subMenuButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            subSubMenuButton.setEnabled(subMenuButton.getSelection());
        }
    });

    /* Set the default state */
    barButton.setSelection(true);
    dropDownButton.setSelection(true);
    popUpButton.setSelection(true);
    cascadeButton.setSelection(true);
    checkButton.setSelection(true);
    pushButton.setSelection(true);
    radioButton.setSelection(true);
    separatorButton.setSelection(true);
    subSubMenuButton.setEnabled(subMenuButton.getSelection());
}