swt 的tree怎么把各个节点之间的连接虚线去掉呢??

zhang4138151 2008-02-22 11:52:10
RT!~~
谢谢!~~~
...全文
152 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
jason_zzw 2008-07-18
  • 打赏
  • 举报
回复
这段代码可以你看看!

/**
*author jason
*/

package com.wzkj.test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

public class TreeSample {

private Shell sShell = null;

public TreeSample() {
// TODO 自动生成构造函数存根
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
/* Before this is run, be sure to set up the launch configuration (Arguments->VM Arguments)
* for the correct SWT library path in order to run with the SWT dlls.
* The dlls are located in the SWT plugin jar.
* For example, on Windows the Eclipse SWT 3.1 plugin jar is:
* installation_directory\plugins\org.eclipse.swt.win32_3.1.0.jar
*/
Display display = Display.getDefault();
TreeSample thisClass = new TreeSample();
thisClass.createSShell();
thisClass.sShell.open();
while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new Shell();
sShell.setText("Shell");
sShell.setSize(new Point(300, 200));
sShell.setLayout(new FillLayout());

Tree tree = new Tree(sShell, SWT.FULL_SELECTION);
tree.setSize(200, 100);
TreeItem root = new TreeItem(tree, SWT.NULL);
root.setText("root");

for (int i = 0; i < 10; i++) {
TreeItem item = new TreeItem(root, SWT.NULL);
item.setText("Item"+i);
}


}

}

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧