【发布时间】:2012-10-26 08:21:59
【问题描述】:
我正在开发一个 Swing 应用程序,我必须在其中显示 HTML 文件。
我正在使用JEditorPane 控制它。它显示 HTML 文件的内容,但格式与实际 HTML 文件中的原始格式不同。
JEditorPane 不支持object 元素。而不是加载目标文件,它只显示?。
除了JEditorPane,Swing 中是否还有其他内置控件可以浏览 HTML 文件?
我正在使用以下代码:
JEditorPane HtmlPane= new JEditorPane();
File file1= new File("path of the file");
HtmlPane.setContentType("text/html");
HtmlPane.setEditable(false);
HtmlPane.setPage(file1.toURI().toURL());
JScrollPane jsp=new JScrollPane(HtmlPane);
【问题讨论】:
标签: java html swing awt jeditorpane