Mega Code Archive

 
Categories / Java / SWT Jface Eclipse
 

SWT Radio Button

import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class MainButton {   public static void main(String[] args) {     final Display display = new Display();     Shell shell = new Shell(display);     shell.setText("Radio Buttons");     shell.pack();     Button[] radios = new Button[3];     radios[0] = new Button(shell, SWT.RADIO);     radios[0].setSelection(true);     radios[0].setText("Choice 1");     radios[0].setBounds(10, 5, 75, 30);     radios[1] = new Button(shell, SWT.RADIO);     radios[1].setText("Choice 2");     radios[1].setBounds(10, 30, 75, 30);     radios[2] = new Button(shell, SWT.RADIO);     radios[2].setText("Choice 3");     radios[2].setBounds(10, 55, 75, 30);     shell.open();     shell.pack();     while (!shell.isDisposed()) {       if (!display.readAndDispatch())         display.sleep();     }     display.dispose();   } }