[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [platform-swt-dev] Transparent images in Labels
|
In order to get transparency working in a label you have to draw it
yourself.
Label imageLabel = new Label(parent, SWT.NONE);
InputStream is = this.getClass().getResourceAsStream("some.gif");
final Image image = new Image(imageLabel.getDisplay(), is);
imageLabel.addDisposeListener(new DisposeListener()
{
public void widgetDisposed(DisposeEvent e)
{
//get rid of the image when the dialog closes.
image.dispose();
}
});
imageLabel.addPaintListener(new PaintListener()
{
public void paintControl(PaintEvent e)
{
e.gc.drawImage(image, 0, 0);
}
});
Rob
-----Original Message-----
From: platform-swt-dev-admin@xxxxxxxxxxx
[mailto:platform-swt-dev-admin@xxxxxxxxxxx] On Behalf Of Federico Daniel
Tello Gentile
Sent: Monday, February 24, 2003 9:46 AM
To: platform-swt-dev@xxxxxxxxxxx
Subject: [platform-swt-dev] Transparent images in Labels
If I didn't misunderstand if I load a GIF and put it on a label
(setImage()) I should see the label's background color where the gif's
transparent color is setted.
The gif I'm using is transparent if I put it inside a word document.
Here's how I load the image.
...
InputStream is = this.getClass().getResourceAsStream("some.gif");
return new Image(this.getDisplay(), is);
...
I don't get the transparency effect.
Any thoughts?
Federico
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev