package com.deveshcodelab.examples.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class SWTSnippet6 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(2, true));
Button redbutton = new Button(shell, SWT.RADIO | SWT.BORDER);
redbutton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
redbutton.setText("Red");
Button greenbutton = new Button(shell, SWT.RADIO | SWT.BORDER);
greenbutton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
greenbutton.setText("Green");
redbutton.setSelection(true);
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}