import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
public class RadioNoGroup {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Menu menuBar = new Menu(shell, SWT.BAR);
Menu fileMenu = new Menu(menuBar);
MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE);
fileItem.setText("File");
fileItem.setMenu(fileMenu);
MenuItem itema = new MenuItem(fileMenu, SWT.RADIO);
itema.setText("Radio A");
MenuItem itemb = new MenuItem(fileMenu, SWT.RADIO);
itemb.setText("Radio B");
MenuItem itemc = new MenuItem(fileMenu, SWT.RADIO);
itemc.setText("Radio C");
shell.setMenuBar(menuBar);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}
|