tags:

views:

33

answers:

1

I am a newbie to java programming.With using SWT library,I try to make a GUI sample. My problem is:

I wanna group some buttons by using "group.add(button);" method.

  Button cb3 = new Button(c3, SWT.RADIO);
  cb3.setSize(20, 20);
  cb3.setLocation(110, 3);

  ButtonGroup radios = new ButtonGroup();
  radios.add(cb3);

But I get this error:

  • The method add(AbstractButton) in the type ButtonGroup is not applicable for the arguments ().

My kind regards.

+1  A: 

You are trying to use a Swing class (ButtonGroup) with SWT. In SWT, you could create the buttons in a Composite to form a group. Check out the button snippets on http://eclipse.org/swt/snippets

Fabian Steeg
Actually, I need 3 radio button but each of them are in different Composite group,already.And,they are in different locations in screen.So the thing I try to do single selection among them.
scratmiller