Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Using StyleRanges

StyledText uses instances of the StyleRange class to track the colors and styles. Each StyleRange controls a portion of the StyledText's text: its starting offset its length (in characters) of the portion the foreground color background color, font style. StyleRange Fields FieldDescription Color backgroundThe background color, or null to for the default background color. int fontStyleThe font style (SWT.NORMAL or SWT.BOLD). Color foregroundThe foreground color, or null for the default foreground color. int lengthThe length, in number of characters. int startThe starting offset.