簡體   English   中英

監視窗格的打印

[英]print of jeditor pane

在秋千上,我有一個帶有JScrollPane的組件JEditorPane,我想從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)
 {

  }

您可以使用編輯器套件獨立打印機http://java-sl.com/JEditorPanePrinter.html

要添加頁面標題,只需修改根視圖的paint()方法,在上面添加內容即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM