import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /** * @author Thomas Singer */ public class ThemedToolBarTest { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout()); final ToolBar toolBar = new ToolBar(shell, SWT.HORIZONTAL); toolBar.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); final ToolItem toolItem1 = new ToolItem(toolBar, SWT.PUSH); toolItem1.setImage(display.getSystemImage(SWT.ICON_QUESTION)); toolItem1.setText("Question"); final ToolItem toolItem2 = new ToolItem(toolBar, SWT.PUSH); toolItem2.setImage(display.getSystemImage(SWT.ICON_ERROR)); toolItem2.setText("Error"); toolItem2.setEnabled(false); final Button checkbox = new Button(shell, SWT.CHECK); checkbox.setText("Click me"); toolBar.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); final Color background = new Color(display, 64, 64, 64); final Color foreground = display.getSystemColor(SWT.COLOR_GRAY); shell.setBackground(background); toolBar.setBackground(background); toolBar.setForeground(foreground); checkbox.setBackground(background); checkbox.setForeground(foreground); shell.setSize(400, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } background.dispose(); display.dispose(); } }