Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Using a LineStyleListener

LineStyleListeners examine single lines at a time. LineStyleEvent Fields FieldDescription int lineOffsetThe zero-based offset, relative to the whole text, of the line the StyledText needs style information for. Note: this is the character offset, not the line number. String lineTextThe text of the line the StyledText needs style information for. StyleRange [] stylesThe array that holds the StyleRange objects you create for the line. To calcualate the offset for StyleRanges int styleRangeOffset = offsetIntoLine + event.lineOffset;