[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Toolbars with a gradient background?
|
- From: Jakob Lyng Petersen <jlp@xxxxxxxxxxx>
- Date: Mon, 07 Apr 2008 13:41:35 +0200
- Newsgroups: eclipse.platform.swt
- Organization: EclipseCorner
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071128 SeaMonkey/1.1.7
Hi,
I would like to create a toolbar with a gradient background. ToolItems
added to the toolbar, should be drawn "on top" of the gradient.
Having played around with this, it seems that I'm only able to have the
gradient drawn on top of the ToolItems.
Basically, what I'm doing is something like this:
ToolBar tb = new ToolBar(parent, SWT.HORIZONTAL);
tb.addPaintListener(new PaintListener() {
public void paintControl(final PaintEvent e) {
e.gc.setForeground(e.display.getSystemColor(SWT.COLOR_RED));
e.gc.setBackground(e.display.getSystemColor(SWT.COLOR_YELLOW));
e.gc.fillGradientRectangle(0, 0, tb.width, tb.height, true);
}
});
ToolItem ti1 = new ToolItem(tb, SWT.PUSH);
ti1.setText("Button 1");
Now, the result of the above is that the I can see the gradient, but not
the tool item. If I just draw a line in the paint listener, I can see
that the line is drawn on top of the tool item.
Is there a way to have the tool items "above" the gradient "background"?
Thanks,
Jakob Lyng Petersen.