Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to change colour of label in swt tree editor(how to change colour of label in swt tree editor in between)
how to change colour of label in swt tree editor [message #1019345] Fri, 15 March 2013 13:55 Go to next message
abc test is currently offline abc test
Messages: 4
Registered: January 2013
Junior Member
I have a TreeEditor and some text in its first column. I need to append some text to it using a label or string. In addition, I want to change the color of the appended string to green. I tried to do it with this code, but it isn't working:

Label label = new Label(this.tree ,SWT.RIGHT);
label.setFont(new Font(getSite().getShell().getDisplay(), ("Hello"), 18,
SWT.BOLD));
label.setText("hello:));
label.pack();
treeItem.setText(1, hi + " " + label.getText());

How could I accomplish this?
Re: how to change colour of label in swt tree editor [message #1021736 is a reply to message #1019345] Wed, 20 March 2013 15:44 Go to previous message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi abc,

I think you are looking for a IStyledLabelProvider.

Best regards,

Wim


> I have a TreeEditor and some text in its first column. I need to append
some text to it using a label or string. In addition, I want to change the
color of the appended string to green. I tried to do it with this code, but
it isn't working:
>
> Label label = new Label(this.tree ,SWT.RIGHT);
> label.setFont(new Font(getSite().getShell().getDisplay(), ("Hello"), 18,
> SWT.BOLD));
> label.setText("hello:));
> label.pack();
> treeItem.setText(1, hi + " " + label.getText());
>
> How could I accomplish this?
Previous Topic:RCP closing view handle
Next Topic:Toolbar pulldown - item order
Goto Forum:
  


Current Time: Mon Oct 20 21:14:20 GMT 2014

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

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