2012-10-26 2 views
1

스윙에서 JScrollPane을 사용하는 JEditorPane 구성 요소가 있습니다. jeditorpane의 내용을 인쇄하고 싶습니다. 그리고 런타임에 인쇄 페이지의 제목을 변경할 수있는 유연성이 있어야합니다. 나는 다음과 같은 코드를 사용하고 있지만이jeditor pane의 프린트

try{ 
    JEditorPane editorpane1= new JEditorPane(); 
    editorpane1.setContentType("text/html"); 
    editorpane1.setEditable(false); 
    File file1= new File("path of the html file"); 
    URL url= new URL(file1); 
    editorpane1.setPage(url); 
    JScrollPane jsp= new JScrollPane(editorpane1); 
    editorpane1.print(); 
    } 
catch(Exception ex) 
{ 

    } 
+0

파일 또는 프린터로 인쇄 – mKorbel

답변

1

당신은 페이지 머리글 바로 위의 내용을 추가 루트 뷰의 paint() 메소드를 수정, 추가하려면 에디터 킷의 independet 프린터 http://java-sl.com/JEditorPanePrinter.html

을 사용할 수 있습니다 작동하지 않습니다.