Images Display in SWT Browser using in memory text [message #905424] |
Thu, 30 August 2012 07:07  |
Eclipse User |
|
|
|
Hi,
I am using org.eclipse.swt.browser.Browser in my code.I have created the html text and and i passing this html content to browser using setText method. My html has one image which is available in other plugin jar file. But this images does not get displayed in Browser. As suggested in eclipse forum i have tried to use <base href="#"> in code but it is not working. My code is as below:-
public static void main(String[] args) {
/* Relative links: use the HTML base tag */
String html = "<html><head>"
+ "<title>HTML Test</title></head>"
+ "<body><p><img src=\"jar:file:/d:/inst/testplugin.jar/mytest/images/file12.png\">"
+ "</p><br/><br/>"
+ "<A NAME=\"link\">This is the target<A/></body></html>";
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, SWT.NONE);
browser.setText(html);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
I am not getting what is wrong. But somehow browser is not getting this file.
Please suggest me how can i resolve this issue?
Thanks,
Pinky
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06413 seconds