revo
revo

Reputation: 538

Java SWT Image background color

I have a TableItem and i wish to add an image in it. I use this code :

Image image = new Image(Display.getCurrent(), 400, height);
image.setBackground(COLOR_RED); 
item.setImage(5, image);

The problem is the background color is never setting in the image. My goal is to get a transparent image background.

How can I do that?

Upvotes: 2

Views: 1662

Answers (1)

the.duckman
the.duckman

Reputation: 6406

Please read the JavaDoc of Image.setBackground. That method does not fill your image with red color.

Also, by setting an image to a TableItem you cannot draw anything, like text, transparently below that image. If you want to do something like that, you'll need "owner draw", see here for a tutorial on that.

Upvotes: 3

Related Questions