欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jface table column tiptext

程序员文章站 2022-06-01 22:13:17
...

TableViewer v = new TableViewer(shell, SWT.FULL_SELECTION);
v.getTable().setLinesVisible(true);
v.getTable().setHeaderVisible(true);
v.setContentProvider(new MyContentProvider());
ColumnViewerToolTipSupport.enableFor(v,ToolTip.NO_RECREATE);

CellLabelProvider labelProvider = new CellLabelProvider() {

public String getToolTipText(Object element) {
return "Tooltip (" + element + ")";
}

public Point getToolTipShift(Object object) {
return new Point(5, 5);
}

public int getToolTipDisplayDelayTime(Object object) {
return 200;
}

public int getToolTipTimeDisplayed(Object object) {
return 5000;
}

public void update(ViewerCell cell) {
cell.setText(cell.getElement().toString());

}
};

TableViewerColumn column = new TableViewerColumn(v, SWT.NONE);
column.setLabelProvider(labelProvider);
column.getColumn().setText("Column 1");
column.getColumn().setWidth(100);