• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

SWT Composite setBackgroundImage() doesn't support transparency?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to do the following:

A composite with background image contains a composite with a transparent background image which itself contains a label:

composite with background image->composite with transparent background image->label

The idea is, that the label inherits in first place the background of its parent composite, and in second place (where background is transparent) the background of the "root" composite.

But now it looks like SWT can't handle transparent background images for composites. The transparent section is replaced by white color instead of being transparent (at least under windows).

Now this is my question: Do I do something wrong or are transparent background images not supported by SWT? If so, is there a workaround?

Thanks in advance!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

I had the same problem, I created my own Icons, so needed a clickable image+text with transparent background. I did this:

http://www.javafr.com/codes/SWT-CUSTOM-FILE-BROWSER_48514.aspx

there are 2 things:
1- shell.setBackgroundMode(SWT.INHERRIT_DFAULT);
to make all childrens hinerit from the shell background

2-Class MyIcon entends Composite{
MyIcon(Composite parent, int style){
super(parent, SWT.TRANSPARENCE_ALPHA);}
}

It's very young but I draw my own Image in a Composite with a transparent background, so I see the background image of my shell.

Hope it can help
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic