日期:2014-05-17 浏览次数:20708 次
方法一
这是比较基本的方法
JEditPane XD = new JEditPane(); XD.setEditorKit(new HTMLEditorKit()); XD.setText( " <h1> zz </h1> ");?
?
JEditPane XD = new JEditPane(); XD.setContentType( "text/html "); HTMLEditorKit kit = new HTMLEditorKit(); XD.setEditorKit(kit); HTMLDocument doc = (HTMLDocument)XD.getDocument(); File f = new File( "sample.html "); try { FileInputStream reader = new FileInputStream(f); kit.read(reader,doc,0); }catch(Exception e) { e.printStackTrace(); }?