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.

Is printing thread safe?

printing safe thread
0
Posted

Is printing thread safe?

0

No, J2Printer’s background printing support provides no thread safety. You need to ensure that the JTextPane, JTable, etc. being printed by J2Printer doesn’t change out from under J2Printer, otherwise unpredictable results may occur. J2Printer’s use of the JTextPane or JTable, etc. is read-only, so it is usually OK to scroll and view your components while the printing of it is underway, but it is not OK to modify (including resize) or delete them. Likewise, you should not change other J2PrinterWorks parameters like margins, headers, footers, etc. while separate thread printing is underway, otherwise unpredictable results will occur. Thread safety problems typically manifest themselves as intermittent errors, where small, often unrelated changes in your program or document (or just running it again) can affect when or whether an error occurs, what the error is, or the printed output itself. If you suspect you have thread-safety problems, any of the following can be used to avoid the pro

Related Questions

What is your question?

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