StyledCellLabelProvider ignores fontStyle [message #532313] |
Fri, 07 May 2010 18:47  |
Eclipse User |
|
|
|
I can use a StyleRange to create a bold, red text field:
StyledText text = new StyledText(composite, SWT.NONE);
text.setText("bla bla");
StyleRange style = new StyleRange();
style.fontStyle = SWT.BOLD;
style.foreground = getSystemColor(SWT.COLOR_RED);
style.length = text.getText().length();
text.setStyleRanges(new StyleRange[] { style });
But using the same StyleRange in a StyledCellLabelProvider results in a cell that is red, but not bold!
class TestLabelProvider extends StyledCellLabelProvider {
@Override
public void update(ViewerCell cell) {
cell.setText("bla bla");
StyleRange style = new StyleRange();
style.fontStyle = SWT.BOLD;
style.foreground = getSystemColor(SWT.COLOR_RED);
style.length = cell.getText().length();
cell.setStyleRanges(new StyleRange[] { style });
}
}
On the other hand setting style.font to a bold red font works.
Bug?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03835 seconds