how to change colour of label in swt tree editor [message #1019345] |
Fri, 15 March 2013 09:55  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.03520 seconds