import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class RadioButtonComposite {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Composite composite = new Composite(shell, SWT.NULL);
composite.setLayout(new RowLayout());
Button mrButton = new Button(composite, SWT.RADIO);
mrButton.setText("Mr.");
Button mrsButton = new Button(composite, SWT.RADIO);
mrsButton.setText("Mrs.");
Button msButton = new Button(composite, SWT.RADIO);
msButton.setText("Ms.");
Button drButton = new Button(composite, SWT.RADIO);
drButton.setText("Dr.");
shell.open();
// Set up the event loop.
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
// If no more entries in event queue
display.sleep();
}
}
display.dispose();
}
}