HTML tags embedded into setText() method's param in SWT?
Stackoverflow people ! I've been trying to embed the HTML tags like color, font etc into the setText() method of the Label component in SWT forms for few days, but it's not working. I'm inspired by the SWIN开发者_运维问答G features where we can do that.Please, suggest me.
I don't know of any automatic way to parse HTML tags besides using a Browser widget, but you could get some pretty results by using the StyledText widget. You can apply an array of StyleRanges (which include aspects like font, foreground color, background color, and other things that you would normally use HTML tags for) to the widget in order to get the styles you want. To get it to behave like a Label, call
styledText.setEditable(false);
styledText.setEnabled(false);
That way users won't be able to select or modify the contents of your widget.
精彩评论