Adding an SWT Button to a ButtonGroup
Using SWT, I want to group some buttons by using the group.add(bu开发者_JAVA技巧tton);
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:
- The method add(AbstractButton) in the type ButtonGroup is not applicable for the arguments ().
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
精彩评论