创建一个主窗口:
public class MainWindow extends ApplicationWindow { /**
 * Create the application window.
 */
private TestAction testAction;//首选项

public MainWindow() {
super(null);
createActions();
addToolBar(SWT.FLAT | SWT.WRAP);
addMenuBar();
addStatusLine();
} /**
 * Create contents of the application window.
 * @param parent
 */
@Override
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NONE); return container;
} /**
 * Create the actions.
 */
private void createActions() {
// Create the actions
testAction = new TestAction(this);
} /**
 * Create the menu manager.
 * @return the menu manager
 */
@Override
protected MenuManager createMenuManager() {
MenuManager menuManager = new MenuManager();
return menuManager;
} /**
 * Create the toolbar manager.
 * @return the toolbar manager
 */
@Override
protected ToolBarManager createToolBarManager(int style) {
ToolBarManager toolBarManager = new ToolBarManager(style);
toolBarManager.add(testAction);

return toolBarManager;
} /**
 * Create the status line manager.
 * @return the status line manager
 */
@Override
protected StatusLineManager createStatusLineManager() {
StatusLineManager statusLineManager = new StatusLineManager();
return statusLineManager;
} /**
 * Launch the application.
 * @param args
 */
public static void main(String args[]) {
try {
MainWindow window = new MainWindow();
window.setBlockOnOpen(true);
window.open();
Display.getCurrent().dispose();
} catch (Exception e) {
e.printStackTrace();
}
} /**
 * Configure the shell.
 * @param newShell
 */
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("test");
} /**
 * Return the initial size of the window.
 */
@Override
protected Point getInitialSize() {
return new Point(450, 300);
}}
继承与Action的对象TestAction
public class TestAction extends Action {

private MainWindow mainwindow;

public TestAction(MainWindow mainjface){
super();
this.setText("开启服务");
this.mainwindow = mainwindow;
}

public void run(){
}}上述代码就会产生一个窗体,在窗体上方的工具栏就会出现一个按钮。
我想问问大家,如果我想更改工具栏中的按钮是SWT.RADIO样式的,我在哪里更改呢?