在 Codename one webbrowser 中显示 HTML 代码
Display HTML code inside Codename one webbrowser
我有一些代码一 HTML,我想在 WebBrowser 上显示这段代码,我使用的是代码一。
我试过这个简单的代码:
protected void beforeWebcams(Form f) {
WebBrowser browser=new WebBrowser();
f.setLayout(new FlowLayout());
f.addComponent(browser);
f.show();
String htmlcode=""<!DOCTYPE html>\n" +
"<html>\n" +
"<body>\n" +
"\n" +
"<h1>My First Heading</h1>\n" +
"\n" +
"<p>My first paragraph.</p>\n" +
"\n" +
"</body>\n" +
"</html>\n";
browser.setURL(data);
模拟器显示空白页。
想法??
如果您只想显示 HTML 代码,而不是 web-page,那么为什么不使用 TextArea 来显示代码。
或者如果你想显示为网页内容那么你可以使用这个代码
wb.setPage(htmlcode,null);
干杯
我有一些代码一 HTML,我想在 WebBrowser 上显示这段代码,我使用的是代码一。
我试过这个简单的代码:
protected void beforeWebcams(Form f) {
WebBrowser browser=new WebBrowser();
f.setLayout(new FlowLayout());
f.addComponent(browser);
f.show();
String htmlcode=""<!DOCTYPE html>\n" +
"<html>\n" +
"<body>\n" +
"\n" +
"<h1>My First Heading</h1>\n" +
"\n" +
"<p>My first paragraph.</p>\n" +
"\n" +
"</body>\n" +
"</html>\n";
browser.setURL(data);
模拟器显示空白页。
想法??
如果您只想显示 HTML 代码,而不是 web-page,那么为什么不使用 TextArea 来显示代码。
或者如果你想显示为网页内容那么你可以使用这个代码
wb.setPage(htmlcode,null);
干杯