2016-08-20 11 views
1

私のプログラムのJEditorPaneは、Googleの例のように、googleの例では でしたが、CSSスタイルはまったく表示されません。 ええと、 は私のコードを確認してください。JEditorPaneのウェブサイトが正しく表示されています

JEditorPane editorPane = new JEditorPane() { 
     public boolean getScrollableTracksViewportWidth() { 
      return true; 
     }}; 

    editorPane.setEditable(false); 

    HTMLEditorKit kit = new HTMLEditorKit(); 
    Document doc = kit.createDefaultDocument(); 
    editorPane.setDocument(doc); 
    editorPane.setEditorKit(kit); 

    try { 
     editorPane.setContentType("text/html"); 
     editorPane.setPage("http://www.google.fr/"); 
    }catch (IOException e) { 
     editorPane.setContentType("text/html"); 
     editorPane.setText("<html>We can't load this page</html>" 
       + e.getMessage() + " "); 
    } 

    editorPane.setBounds(295, 265, 491, 474); 
    editorPane.setBorder(new LineBorder(new Color(0, 0, 0))); 

    pan.add(editorPane); 

私はちょうどニュースなどの情報を表示するためのJavaコンポーネントでWebサイトを表示したい、 誰も私を助けてくださいことができますか?

答えて

1

JEditorPaneは基本HTMLのみをサポートします。

完全サポートのために、システムのデフォルトブラウザを使用することができます。スクロールチュートリアルのHow to Integrate with the Desktop Classのセクションで、 "BROWSE"機能を使用する実例を確認してください。

関連する問題