You need to add a LineStyleListener to the StyledText widget:
textField.addLineStyleListener (...); ... public void lineGetStyle (LineStyleEvent e) { // alloc a set of styles for the requested line e.styles = new StyleRange [...]; for (int i = 0; i < e.styles.length; i++) { StyleRange styleRange = new StyleRange (); styleRange.start = ...; styleRange.length = ...; styleRange.underline = true; styleRange.foreground = <URL colour>; e.styles [i] = styleRange; } }
Javadoc for LineStyleListener will provide you more information.
To add click behavior, you need one more logic: I could also insert some code that we use to automatically add the URL of the HTML style link as a StyledText widget if that helps.
Matthew phillips
source share