谁能告诉我如何将 html 文档加载到 JEditorPane 中。我尝试了以下方法,但似乎不起作用:
try{
URL h = new URL("file://test.html");
pane.setPage(h);
} catch (Exception e) {}
最佳答案
在java中的jeditor Pane 中打开html文件
JeditorPane editorpane= new JEditorPane();
editorScrollPane = new JScrollPane(editorpane);
editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
File file = new File("F://test.htm");
editorpane.setPage(file.toURI().toURL());
editorpane.setEditable(true);
希望这对您有帮助, 在这里,这是工作
关于java - 将 html 文件加载到 JEditorPane 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15052690/