Chinaunix
标题:
求助:eclipse插件开发中,怎么显示大量文字啊?
[打印本页]
作者:
Hooraykxld
时间:
2012-07-18 16:17
标题:
求助:eclipse插件开发中,怎么显示大量文字啊?
我用的是SWT中的Label或Text等,最多显示1000多字,再多了程序就死了
我的代码:
org.eclipse.swt.widgets.Text fText = getWidgetFactory().createText(parent,
“”,
SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
int style = GridData.FILL_HORIZONTAL;
gd = new GridData(style);
gd.widthHint = 50;
fText.setLayoutData(gd);
fText.setText(text); //text长度为8000
作者:
isaacxu
时间:
2012-07-18 22:29
也许可以考虑使用StyledText,具体参见SWT的例子org.eclipse.swt.examples.javaviewer 。如果要可编辑参见org.eclipse.swt.examples.texteditor
void createStyledText() {
text = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
GridData spec = new GridData();
spec.horizontalAlignment = GridData.FILL;
spec.grabExcessHorizontalSpace = true;
spec.verticalAlignment = GridData.FILL;
spec.grabExcessVerticalSpace = true;
text.setLayoutData(spec);
text.addLineStyleListener(lineStyler);
text.setEditable(false);
Color bg = Display.getDefault().getSystemColor(SWT.COLOR_GRAY);
text.setBackground(bg);
}
显示.jpg
(224.08 KB, 下载次数: 14)
下载附件
2012-07-18 22:28 上传
无问题.jpg
(106.22 KB, 下载次数: 13)
下载附件
2012-07-18 22:28 上传
作者:
dyllove98
时间:
2012-07-23 19:02
1000个汉字程序就死机?你是不是需要升级版本了..
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2