在执行打印操作之前,如何在 JDialog
中提供 JTextArea
的预览?打印对话框不提供此选项!
最佳答案
您可以使用 TextComponentPrintable.getPrintable(textArea, null, null)
并使用 print() 方法传递 JPanel 的 Graphics 来渲染打印 View 。
JEditorPane 也有解决方案 http://java-sl.com/JEditorPanePrinter.html
关于java - 打印前预览 JTextArea,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8386243/