I have an about dialog in Swing that uses a JEditorPane to display an html document (setContentType("text/html");).
I want to creat an about dialog in an Eclipse SWT application and display this same html document which will be displayed formatted (hyperlinks, br etc) same as it did in Swing.
How could I do this? What is the appropriate widget? StyledText?
I started with a Browser in a Handler:
@Execute
public void execute(final Shell currentShell){
//load html file in textReader
Browser browser = new Browser(currentShell, SWT.NONE);
browser.setText(textReader.toString());
}
But nothing is displayed. What is the proper way to resolve this?
Update: Tested @Baz change:
@Execute
public void execute(final Shell currentShell){
currentShell.setLayout(new FillLayout());
//load html file in textReader
Browser browser = new Browser(currentShell, SWT.NONE);
browser.setText(textReader.toString());
currentShell.pack();
}
It completelly ruins the application! The html is loaded covering the existing elements
You can always use the good old JFace
Dialogwith an embeddedBrowserwidget:Looks like this:
If you want the dialog buttons, just replace the
createButtonsForButtonBar(Composite parent)method with this:Then it will look like this: