用JEditorPane.setPage(String url) 往JEditorPane中输入内容后显示的HTML的源代码,内容格式为"text/plain", 怎样使其内容格式一直为 " text / html " 显示HTML的可视化界面,谢谢!
(使用JEditorPane.setContentType("text / html") 不行)
(使用JEditorPane.setContentType("text / html") 不行)
jEditorPane.setContentType("text/html");
也不行吗,报什么错误?
上面也是遇到这个问题好像是版本的bughttp://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4149008"I've been trying to do exactly this with swing 1.1.1 beta2 and find the same
bug. The bug report states that this bug has been fixed, but I can't tell from
the bug report orits evaluation section whether or not this bug has been fixed
in the release I'm trying to use"
public static void main(String[] args) throws Exception{
JEditorPane pane=new JEditorPane();
pane.setContentType("text / html");
pane.setPage("http://www.baidu.com");
JFrame frame=new JFrame();
//frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(pane);
frame.setSize(1024, 768);
frame.setVisible(true);
}