Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

After printing, can I change the contents of my JTextPane and have the same J2TextPrinter print the new contents?

0
Posted

After printing, can I change the contents of my JTextPane and have the same J2TextPrinter print the new contents?

0

Yes, but you have to call setPane again for your JTextPane before you print a second time in order to get the J2TextPrinter to recognize the new contents. This is because J2TextPrinter copies your JTextPane contents into an internal JTextPane so that it can reflow the text to the printed page width without disrupting the on-screen appearannce of your JTextPane, but it only does this the first time you print. Calling setPane will cause the J2TextPrinter to recopy your JTextPane and capture the new contents.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123