开发者

Java SWT Image background color

开发者 https://www.devze.com 2023-04-07 00:39 出处:网络
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);

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 th开发者_运维问答e image. My goal is to get a transparent image background.

How can I do that?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消