2014-02-19 2 views
0

일부 텍스트와 특정 로고 및 꼬리말이 포함 된 헤더를 일부 텍스트와 페이지 번호로 인쇄하려고합니다.JEditorPane의 이미지를 헤더로 추가하는 방법

헤더에 이미지를 추가하는 방법은 무엇입니까?

public class JEditorPaneTest { 
    public static void main(String args[]) { 
     JEditorPane pane = new JEditorPane(); 
     JScrollPane js = new JScrollPane(pane); 
     try { 
      URL url = new URL("file:C:/temp/html/12.html"); 
      // File f=new File("C:/temp/html/12.html"); 
      pane.setPage(url); 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     pane.setContentType("text/html"); 
     JFrame frmae = new JFrame(); 
     frmae.setSize(200, 300); 
     try { 
      MessageFormat header = new MessageFormat("Order Details History"); 
      MessageFormat footer = new MessageFormat(" Page #{0,number,integer}"); 
      pane.print(header, footer); 

     } catch (PrinterException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     // frmae.add(pane); 
     frmae.add(js); 
     frmae.setVisible(true); 
    } 
} 

답변