如何在SWT表列中添加超链接?我正在使用org.eclipse.swt.widgets.Table类.
有没有办法在不使用TableViewer,JFace的情况下做到这一点?
我试过这种方式,但没有正常工作(没有显示超链接).
for(int i=2; i<4; i++){
Hyperlink link = new Hyperlink(table, SWT.WRAP);
link.setText(temp[i]);
link.setUnderlined(true);
TableEditor editor = new TableEditor(table);
editor.setEditor(link, tableItem[index-1], i); //set hyperlinks in column i
}
Run Code Online (Sandbox Code Playgroud)
是的,这当然有可能。要做到这一点,你必须实现SWT.ItemPaint(也可能是SWT.ItemErase和SWT.ItemMeassure)。
TableView不过,如果您使用正确的方法,那就更容易了LabelProvider...