How to set color and font for a table cell using TableViewer in JFace?
All you need to do is make your ITableLabelProvider implementation also implement ITableFontProvider and ITableColorProvider.
public class TypeLabelProvider implements ITableLabelProvider,
ITableFontProvider, ITableColorProvider {
...
...
ITableLabelProvider methods
...
...
@Override
public Font getFont(Object element, int columnIndex) {
return JFaceResources.getFontRegistry().getBold(
JFaceResources.DIALOG_FONT);
}
@Override
public Color getBackground(Object element, int columnIndex) {
return new Color(display, new RGB(125,189,0));
}
@Override
public Color getForeground(Object element, int columnIndex) {
return new Color(display, new RGB(125,189,0));
}
}
2 comments:
thanks!
You save my day :)
Post a Comment