Skip to main content



      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 09:55 Go to next message
Eclipse UserFriend
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 11:44 Go to previous message
Eclipse UserFriend
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: Tue Apr 15 02:45:37 EDT 2025

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

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

Back to the top