[問題] JeditorPane顯示html
如題我想把html呈現在JEditorPane上面,html存在java專案的目錄當中為map.html
但我嘗試了很多次,結果都是沒有顯示任何東西
但把url改為google網址則可以顯示結果。
以下是我的code,可以告訴我哪個部分出錯了嗎@@
sPath = System.getProperty( "user.dir" ) + "/";
URL url=new URL("File:///"+sPath+"map.html");
editorPane = new JEditorPane();
scrollPane.setViewportView(editorPane);
editorPane.setContentType("text/html");
editorPane.setEditable(false);
editorPane.setPage(url);
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.153.80
※ 文章網址: http://www.ptt.cc/bbs/java/M.1401269618.A.0C5.html
→
05/28 18:08, , 1F
05/28 18:08, 1F
File Fhtml=new File("map.html");
URL url=Fhtml.toURI().toURL();
editorPane = new JEditorPane();
scrollPane.setViewportView(editorPane);
editorPane.setContentType("text/html");
editorPane.setEditable(false);
editorPane.setPage(url);
我改成這樣了還是無法QQ...
※ 編輯: forget2009 (140.113.153.80), 05/28/2014 18:14:23
推
05/28 18:58, , 2F
05/28 18:58, 2F
→
05/28 18:58, , 3F
05/28 18:58, 3F
java 近期熱門文章
PTT數位生活區 即時熱門文章