[問題] JeditorPane顯示html

作者: forget2009 (皮卡瘡)   2014-05-28 17:33:32
如題我想把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);
作者: danny8376 (釣到一隻猴子@_@)   2014-05-28 18:08:00
不要自己生... 生個File 然後.toURI().toURL()
作者: PsMonkey (痞子軍團團長)   2014-05-28 18:58:00
你要不要先確認一下 Fhtml.getAbsolutePath()另外,完全沒有錯誤訊息也十分詭異,難道是版規 5 作祟?

Links booklink

Contact Us: admin [ a t ] ucptt.com