[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Can I change the background color of toolbar?

The following makes the toolbar red for me on win32, motif and gtk.  If it
doesn't for you then log a bug report with Platform - SWT.

public class Main {
	public static void main(String[] args) {
		Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setBounds(10,10,200,200);
		Color color = new Color (display, 255, 0, 0);
		ToolBar bar = new ToolBar (shell, SWT.BORDER);
		bar.setBounds(10,10,100,50);
		bar.setBackground(color);
		
		new ToolItem (bar, SWT.NONE).setText("item");
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) display.sleep();
		}
		color.dispose();
		display.dispose();
	}
}

Grant


Eric Suen wrote:

> I have try toolbar.setBackground(color) & setForeground(color) before, but
> the color is still
> the button face color.

> Thanks

> Eric

> "Grant Gayed" <grant_gayed@xxxxxxxxxx> ??????:b7m4r1$1jn$1@xxxxxxxxxxxxxxxx
> > ToolBar inherits #setBackground(Color), so you can use this.  There isn't
> > a way to make the ToolBar transparent though.
> >
> > Grant
> >
> > Eric Suen wrote:
> >
> > > Hi,
> >
> > >     Can I change the background color of toolbar or make it
> > > transparent?
> >
> > > Regrads
> >
> > > Eric
> >
> >
> >
> >
> >