我有以下JTextArea
JTextArea.print()打印空白页
reportText = new JTextArea();
reportText.setColumns(100);
reportText.setLineWrap(true);
reportText.setName("Output Report");
reportText.setAutoscrolls(true);
reportText.setFont(new Font("Courier", Font.PLAIN, 12));
reportText.setEditable(false);
reportText.setSize(new Dimension(300, 500));
我只是希望打印文本reportText
因为是通过reportView.getReportTextArea().print();
。但是,打印机最终会打印空白页。我已经看到了following SO answer,但我设置的大小,所以我不认为这是我的问题。
请注意,我正在稍后在应用程序中设置文本,我没有在这里显示。
还有什么我不见了?我误解了JTextComponent.print()
方法吗?
你在屏幕上看到了什么?因为您没有附加任何文字 – nachokk