我以Java swing形式显示Html文件数据。内容正在显示,但某些格式化受到干扰。图像正在显示,但格式化受到干扰。 和超链接无法正常工作,你可以建议我的代码,我使用下面的代码。 有毛病的setContentType方法在java swing中浏览html文件
File htmlFile = new File("e:/test/help4t.htm");
htmlPane = new JEditorPane();
htmlPane.setContentType("text/html");
htmlPane.setPage(htmlFile.toURI().toURL());
//URL url= new URL("http://www.lawcrux.com");
// htmlPane.setPage(url);
htmlPane.addHyperlinkListener(this);
JScrollPane jsp= new JScrollPane(htmlPane);
cp.add(jsp);
jsp.setBounds(750, 50, 600, 600);
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "exception is" + ex);
}
请帮助
问候
它是(花哨)'http:// www.lawcrux.com /'或者您控制的本地磁盘上的HTML,或者其他您希望显示给最终用户的HTML吗? 'JEditorPane'永远不会呈现该页面(幸运的)或基于JS的日历的基于JS的滚动文本/链接部分。 –
Html文件存储在本地系统上。有没有另一种方法来呈现基于JS的链接和文本 – adesh
我认为JavaFX应该提供一个Web组件。 –