/** Creates the "Control" group. */ void createControlGroup() { super.createControlGroup(); /* Create the group */ alignmentGroup = new Group(controlGroup, SWT.NONE); alignmentGroup.setLayout(new GridLayout()); alignmentGroup.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL)); alignmentGroup.setText(ControlExample.getResourceString("Alignment")); /* Create the controls */ leftButton = new Button(alignmentGroup, SWT.RADIO); leftButton.setText(ControlExample.getResourceString("Left")); centerButton = new Button(alignmentGroup, SWT.RADIO); centerButton.setText(ControlExample.getResourceString("Center")); rightButton = new Button(alignmentGroup, SWT.RADIO); rightButton.setText(ControlExample.getResourceString("Right")); /* Add the listeners */ SelectionListener selectionListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { if (!((Button) event.widget).getSelection()) return; setExampleWidgetAlignment(); } }; leftButton.addSelectionListener(selectionListener); centerButton.addSelectionListener(selectionListener); rightButton.addSelectionListener(selectionListener); }