2013-08-22 39 views
0

在我的应用程序中我有一个对话框,我把文本控制台查看器。在文本控制台查看器中有一些文本。我可以将一些文本作为超链接。任何指针都会被赞赏。如何将超链接文本添加到TextConsoleViewer?

代码:

console = new MessageConsole("Try", null, false); 

outputStream = console.newMessageStream(); 

Composite viewerParent = new Composite(container, SWT.NONE); 

GridLayout layout2 = new GridLayout(); 
layout2.marginBottom = layout2.marginHeight = layout2.marginLeft = layout2.marginRight = layout2.marginTop = layout2.marginWidth = 1; 

viewerParent.setLayout(layout2); 
viewerParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 

viewer = new TextConsoleViewer(viewerParent, console); 
viewer.setEditable(false); 

viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 
+0

你在说什么文本控制台查看器? Eclipse的TextConsoleViewer? Swing的JTextArea/JEditorPane? – hotforfeature

+0

我把它标记为swt,这意味着它是从swt不是从秋千..我是ryt .. – Rajesh

回答

0

此方案如何如何..超文本的 例子中的代码是大,所以我不能张贴在这里,所以我张贴的链接,请参阅本:

http://www.java2v.com/Open-Source/Java-Document/IDE-Eclipse/ui/org/eclipse/ui/console/TextConsoleViewer.java.htm