免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1554 | 回复: 2
打印 上一主题 下一主题

求助:eclipse插件开发中,怎么显示大量文字啊? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-07-18 16:17 |只看该作者 |倒序浏览
我用的是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

论坛徽章:
0
2 [报告]
发表于 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);
  • }


论坛徽章:
0
3 [报告]
发表于 2012-07-23 19:02 |只看该作者
1000个汉字程序就死机?你是不是需要升级版本了..
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP