【发布时间】:2014-05-24 10:17:58
【问题描述】:
代码:
public SelectedMap() {
initComponents();
editorMap_pn.setEditable(false);
try {
editorMap_pn.setPage("<html><body>Hello</body></html>");
} catch (IOException ex) {
Logger.getLogger(SelectedMap.class.getName()).log(Level.SEVERE, null, ex);
}
}
输出:
Tracker.UI.SelectedMap <init>
SEVERE: null
java.net.MalformedURLException: no protocol: <html><body>Hello</body></html>
at java.net.URL.<init>(URL.java:583)
at java.net.URL.<init>(URL.java:480)
at java.net.URL.<init>(URL.java:429)
at javax.swing.JEditorPane.setPage(JEditorPane.java:882)
at Tracker.UI.SelectedMap.<init>(SelectedMap.java:33)
我想在 Java 应用程序中显示 HTML 页面,而不是 URL。 我想输入 HTML 代码作为 setter 的输入并显示 Web 输出。
【问题讨论】:
标签: java html swing url jeditorpane