jEditPane 中好像只能显示<body></body>中的内容

解决方案 »

  1.   

    那163.com肯定有<body></body>
      

  2.   

    我好像没用说清楚,我的意思是你需要自己解析html的源文件从中取出<body></body>中的内容放入jEditPane 中.
    URL url = new URL("http://www.163.com");
    BufferedReader in = new BufferedReader(new InputStreamReader(url
    .openStream()));
    String temp = "";
    String inputLine;
    while ((inputLine = in.readLine()) != null) { temp = temp + inputLine + "\n";
    }
    in.close();
    //System.out.println(temp);
    String weather = temp.substring(temp.indexOf("<body"), temp
    .lastIndexOf("body>") + 5);
    jEditorPane.setText(weather);
      

  3.   

    谢谢 tomy_xu_1981(火星仁) 热心解答
    为什么我放到程序里面显示的是HTML代码而不是网页?
    难道我有RPWT
      

  4.   

    哦,忘了告诉你了你的jEditorPan初始化后应该设置下面的属性
    jEditorPane.setContentType("text/html");
    嘿嘿!