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.

Im using a custom Look & Feel and certain Swing components in my JPanel won print, why?

0
Posted

Im using a custom Look & Feel and certain Swing components in my JPanel won print, why?

0

See similar discussion for JTable under J2TablePrinter above. We have since learned that JButton and other Swing components can have a similar problem with custom Look & Feel libraries like Kunststoff. The same workarounds can be used: 1) change your whole application to “Metal” (cross-platform) Look & Feel using UIManager.setLookAndFeel() 2) change the Look & Feel for the particular component (or a copy used only for printing) to “Metal” or “Basic” using setUI() 3) in the case of Kunststoff where the source code is available, you can modify KunststoffButtonUI.java and/or other component renderers by adding the same “instanceof” test given in the J2TablePrinter discussion above, causing those components to revert to “Metal” or “Basic” Look & Feel only when printing. Alternatively, you can disable the use of Kunststoff gradients for all component printing at one time by adding the “instanceof” test as the first line in the two drawGradient() methods in KunststoffUtilities.java.

Related Questions

What is your question?

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

Experts123