我正在开发 Eclipse 插件。在这里我创建了一个单独的视图,现在我想格式化树节点的颜色。
这些是 createpartcontrol 方法中的代码。
ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL );
Composite composite1 = new Composite(sc, SWT.NONE);
Composite composite_1 = creatingcomposite(composite1);
Tree tree = new Tree(composite_1, SWT.FULL_SELECTION );
TreeItem item = new TreeItem(tree, SWT.NONE);
在这里我想设置一些颜色,比如蓝色。
item.setText("This is sparta");
现在在这里我想要一些不同的颜色,比如子项文本上的黄色。
TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
subsubItem.setText(new String[] { "Function Name: "+ errorPreTest11.description.get(j).function });
为此,我尝试设置 SWT.COLOR_BLUE 但它不起作用。