Community
Participate
Working Groups
public class Main { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBackground(display.getSystemColor (SWT.COLOR_INFO_BACKGROUND)); ToolBar toolBar = new ToolBar(shell, SWT.FLAT | SWT.BORDER); toolBar .setBackground(display .getSystemColor (SWT.COLOR_INFO_BACKGROUND)); for (int i = 0; i < 12; i++) { ToolItem item = new ToolItem(toolBar, SWT.DROP_DOWN); item.setText("test"); } toolBar.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } Before flat toolbars, this worked. Afterwards, the background colour is incorrect. I'll include a screenshot.
Created attachment 8727 [details] Screenshot Screenshot. Industrial theme.
I ran the test app on I20040330 and the background was the same. Is this problem fixed?
SWT has not changed anything that would fix this problem.
I am using I20040406 and still experience the problem.
I am sorry, but I've tried this with a lot of different themes using SWT from 3.0.1 and still cannot reproduce the problem. Please re-open if you can reproduce this with SWT from 3.0.1 or 3.1.
Created attachment 137918 [details] Screenshot depicting the problem in question. I'm not sure if my problem is the same as the reporter's but it fits the summary wherein calling setBackground(Color) seems to do nothing. Instead of getting a green background, I get the standard background colour. What's odd is that for a split second before the items are drawn, you can actually see that that section of the window is green. I'm guessing this is fine on Windows because Kai's CSS demo seems to look fine on Vista. On GTK+ the bar doesn't change colours though. :( ------------- Display display = new Display(); Shell shell = new Shell(display); shell.setSize(300, 200); shell.setLayout(new GridLayout()); ToolBar toolBar = new ToolBar(shell, SWT.BORDER); for (int i = 0; i < 3; i++) { ToolItem item = new ToolItem(toolBar, SWT.PUSH); item.setText("test"); //$NON-NLS-1$ } toolBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); toolBar.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); shell.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose();
Reopening as it's a problem on I20090528-2000. I don't know if it was ever fixed (since it was closed as WORKSFORME).
Back to inbox since Billy doesn't work on SWT anymore.
(In reply to comment #6) > Created an attachment (id=137918) [details] > Screenshot depicting the problem in question. This seems to be caused by my GTK+ theme. Is SWT supposed to override the theme's behaviour?
Not for 3.5
I can't reproduce the bug on latest Neon builds. Resolving the bug please reopen if it still happens with recent Swt.
Verified in I20160124-0800 on linux ppc64.
Verified in I20160124-0800 on ubuntu 15.10 64bit