2016-08-20 7 views
1

예 : Google 예제 인 과 같은 웹 사이트에 내 JEditorPane을 반환했지만 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); 
가 난 그냥 뉴스 등 정보를 표시하는 자바 구성 요소에서 웹 사이트를 표시 할

, 사람이 제발 도움이 될 수 있습니다 어, 내 코드를 확인?

답변

1

JEditorPane은 기본 HTML 만 지원합니다.

전체 지원을 받으려면 시스템의 기본 브라우저를 사용할 수 있습니다. How to Integrate with the Desktop Class의 스윙 튜토리얼에서 "BROWSE"기능을 사용하는 작동 예제를 확인하십시오.