I need to create a SWT StyledText Control which shows the human readable characters with equal spacing for each character as we see in a "notepad".
But when I create a Text
StyledText outputText = new StyledText(scrolledComposite_2, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite_2.setContent(outputText);
scrolledComposite_2.setMinSize(outputText.computeSize(SWT.DEFAULT, SWT.DEFAULT));
outputText.setText(data.toString());
outputText.setStyleRange(new StyleRange(0, data.toString().length(), CMFUtils.GREEN, CMFUtils.WHITE));
When the StyledText is displayed in displays the data, but the width of each character is different. Say for example, the width of 'i' or ' ' (space) is smaller than other characters like 'S', which causes me problems while pointing the errored character using '^' in the next line. For example:
output>>>>
blah-blah-blah-sdlfk-blah
................^
As you can see, the error in the above sample string occurs at "sdlfk" which is at 16th character and when I try to point it by putting a '^' in the next line with 16 spaces (note: the periods in this example will be replaced by spaces in my original output), it points to a different position in the string.