简体   繁体   中英

how to change colour of label in swt tree editor

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?

您可能想看看org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM