|Re: How to add background Image in a StyledText [message #467311 is a reply to message #466950]
||Sat, 28 January 2006 18:38
| Adam Kumpf
Registered: July 2009
Adam Kumpf wrote:|
> dali wrote:
>> I would like to add a background image in StyledText,how to do this.
> I'm not an expert, but I think this should do the trick.
> Display d = new Display(); // you probably already have a display
> Shell s = new Shell(d); // you probably already have a shell
> StyledText st = new StyledText(s,SWT.NONE);
> st.setText("some funny textn to trytt Weee!");
> st.pack(); // automatically set width and height to fit text,
> // you may want to change that.
> st.setLocation(10,10); // set the x,y location
> Image myImage = new Image(st.getDisplay(),"enter file location here...");
> Hope that helps.
> Best Regards,
> Adam Kumpf
I recently needed to take my own advice and add a background image to
StyledText.. But I ran in to the problem you must have been facing. The
normal ways of setting the background image do not work with the
StyledText object because it has other background painters that paint over
the image. I've been trying to find a way to stop them, but I haven't had
Does anyone know how to turn off all of the background painters in a
StyledText object such that the setBackgroundImage(Image) actually sets
the background image? I can see it flicker the image for about a single
frame when I open the window, but then the image is quickly covered by a
white fill of some kind.
Powered by FUDForum
. Page generated in 0.01725 seconds