java - Display HTML text in SWT Label -
i display html text in java swt label. below code creating label.
label thelabel = new label(controls,swt.wrap); thelabel.setsize(100,500); thelable.settext("<html><ol><li>hello</li><li>welcome</li></ol></html>");
when run application eclipse application output as:
<html><ol><li>hello</li><li>welcome</li></ol></html>
what mistake? why not getting html formatted output in label? using eclipse plugin view.
to show html swt have use browser widget instead.
browser browser = new browser( parent, swt.none ); browser.settext( "<html><ol><li>hello</li><li>welcome</li></ol></html>" );
if don't mind dependency on org.eclipse.ui.forms
can use formtext. aware control understand subset of html (<p>
, <b>
, <li>
, <img>
, <br>
, <span>
) render simple formatted text.
Comments
Post a Comment