scratmiller
scratmiller

Reputation: 141

Adding an SWT Button to a ButtonGroup

Using SWT, I want to group some buttons by using the group.add(button); method to add them to a ButtonGroup.

  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:

Upvotes: 2

Views: 8645

Answers (1)

Fabian Steeg
Fabian Steeg

Reputation: 45694

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

Upvotes: 1

Related Questions