2016-06-25 13 views
-3

JTextPaneを印刷ダイアログボックスと印刷の進行状況を画面に表示せずに直接プリンターに印刷します。この目的のために、私は、javadocの中に次のような方法が見つかりました:JTextPaneで印刷せずに印刷するダイアログボックス

textPane.print(headerFormat, footerFormat, boolean showPrintDialog, 
    PrintService service, PrintRequestAttributeSet attributes, boolean interactive); 

を私はPrintServicePrintRequestAttributeSetのためにそこに合格しなければならないパラメータについてどのような値のパラメータ4と5を理解していませんか?

どうすればこの方法を使用することができますか教えてください。

+4

は、APIが何のためにあるのか、このはありませんか? [このメソッドのJTextComponent APIセクション](http://docs.oracle.com/javase/8/docs/api/javax/swing/text/JTextComponent.html#print-java.text.MessageFormat- java.text.MessageFormat-boolean-javax.print.PrintService-javax.print.attribute.PrintRequestAttributeSet-boolean-)まだですか?パラメータが何であるかはかなりわかりますね。 –

答えて

1

@Hovercraft suggestsとして、関連するAPIはあなたの友人です。パラメータは、これらは以下のとおりです。

headerFormat - the text, in MessageFormat, to be used as the header, or null for no header 
footerFormat - the text, in MessageFormat, to be used as the footer, or null for no footer 
showPrintDialog - true to display a print dialog, false otherwise 
service - initial PrintService, or null for the default 
attributes - the job attributes to be applied to the print job, or null for none 
interactive - whether to print in an interactive mode 

あなたはデフォルト/なしの動作を取得するために、このような何かを始めるかもしれません:

textPane.print(null, null, false, null, null, false); 
+0

私はこの 'textPane.print(null、null、false、null、null、false);を使用しますが、まだ印刷ダイアログボックスが表示されます。 – ahad

+0

"GUIが表示されていないアプリケーションからの印刷"を試してください。 – trashgod

関連する問題