Group Example 2 : Group « SWT JFace Eclipse « Java






Group Example 2

Group Example 2
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;

public class GroupShellExample2 {
  Display d;

  Shell s;

  GroupShellExample2() {
    d = new Display();
    s = new Shell(d);
    s.setSize(200, 200);
    
    s.setText("A Group Example");
    final Group g = new Group(s, SWT.SHADOW_ETCHED_IN);
    g.setSize(110, 75);
    g.setText("Options Group");
    final Button b1;
    final Button b2;
    final Button b3;
    b1 = new Button(g, SWT.RADIO);
    b1.setBounds(10, 20, 75, 15);
    b1.setText("Option One");
    b2 = new Button(g, SWT.RADIO);
    b2.setBounds(10, 35, 75, 15);
    b2.setText("Option Two");
    b3 = new Button(g, SWT.RADIO);
    b3.setBounds(10, 50, 80, 15);
    b3.setText("Option Three");
    g.pack();
    g.setLocation(20, 20);
    s.open();
    while (!s.isDisposed()) {
      if (!d.readAndDispatch())
        d.sleep();
    }
    d.dispose();
  }

  public static void main(String[] arg) {
    new GroupShellExample2();
  }

}

           
       








Related examples in the same category

1.Group ExamplesGroup Examples
2.Demonstrates groupsDemonstrates groups
3.Group ExampleGroup Example
4.Group Label and Button
5.SWT Group demoSWT Group demo