スイングでは、コンポーネント JEditorPane と JScrollPane があります。jeditorpane のコンテンツを印刷したいと考えています。実行時に印刷ページの見出しを柔軟に変更できる必要があります。次のコードを使用していますが、機能していません
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)
{
}