Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » StyledText setLineBackground
StyledText setLineBackground [message #441711] Sun, 22 August 2004 17:47 Go to next message
Eclipse UserFriend
Originally posted by: aheenan.ie.ibm.com

Hey people :-)

Well I've run into a slight problem and I'm a bit baffled as to what
is wrong so I am looking to yeerselves for some insight.

I have as follows.....

One editor
A getter that returns the StyledText of said editor.
Code to set the line background ...

IWorkbench wb = org.eclipse.ui.PlatformUI.getWorkbench();
Device dev = wb.getDisplay();
Color orange = new Color(dev, 255, 127, 0);

editor.getTextWidget().setLineBackground(10, 5, orange);

I'm at a loss as to why it's not working, any advise
welcome.

Thanks for you time,
A.
Re: StyledText setLineBackground [message #441736 is a reply to message #441711] Mon, 23 August 2004 00:51 Go to previous messageGo to next message
Andrew Brampton is currently offline Andrew BramptonFriend
Messages: 8
Registered: July 2009
Junior Member
I'm new to SWT, but two questions that may help you
1) Is the Workbench device, the same as the StyledText device?
2) When are you disposing of orange? I'm not sure but I would imagine that
the lifetime of orange would have to be as long as the styledText has that
background line.... So for example if you were doing this:

Color orange = new Color(dev, 255, 127, 0);
editor.getTextWidget().setLineBackground(10, 5, orange);
orange.dispose();

Then I think the background won't show as expected. The solution I can offer
to that is to not dispose of orange so earlier, but do it later... However
don't forget to dipose it ;)

Like I said I'm new to SWT, so this might not shed any light on the
problem... (but if you do find the solution, then I'll be happy to hear it)

Andrew

"Angela Heenan" <aheenan@ie.ibm.com> wrote in message
news:cgalui$9dn$1@eclipse.org...
> Hey people :-)
>
> Well I've run into a slight problem and I'm a bit baffled as to what
> is wrong so I am looking to yeerselves for some insight.
>
> I have as follows.....
>
> One editor
> A getter that returns the StyledText of said editor.
> Code to set the line background ...
>
> IWorkbench wb = org.eclipse.ui.PlatformUI.getWorkbench();
> Device dev = wb.getDisplay();
> Color orange = new Color(dev, 255, 127, 0);
>
> editor.getTextWidget().setLineBackground(10, 5, orange);
>
> I'm at a loss as to why it's not working, any advise
> welcome.
>
> Thanks for you time,
> A.
Re: StyledText setLineBackground [message #441739 is a reply to message #441736] Mon, 23 August 2004 08:16 Go to previous message
Eclipse UserFriend
Originally posted by: aheenan.ie.ibm.com

Andrew Brampton wrote:
> I'm new to SWT, but two questions that may help you
> 1) Is the Workbench device, the same as the StyledText device?

Yup I changed that, not long after I posted, to use the
editor.getTextWidget().getDisplay().


> 2) When are you disposing of orange? I'm not sure but I would imagine that
> the lifetime of orange would have to be as long as the styledText has that
> background line.... So for example if you were doing this:
>

I'm currently not disposing of the orange. I will of course
be changing this in the future.

Thanks,
A.
Previous Topic:How does setPixel work???
Next Topic:SWT and Java Web Start
Goto Forum:
  


Current Time: Thu Sep 19 11:18:53 GMT 2024

Powered by FUDForum. Page generated in 0.03587 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top