On Thu, 2 Jul 2026 05:49:00 GMT, Prasanta Sadhukhan <[email protected]> wrote:
> [JDK-6328248](https://bugs.openjdk.org/browse/JDK-6328248) fixed PrintJob > (1.1 Graphics API) based JProgressBar printing for most L&F however it seems > to cause ClassCastException in AquaProgressBarUI.paint as non-Graphics2D path > was not handled > `Caused by: java.lang.ClassCastException: class sun.print.ProxyPrintGraphics > cannot be cast to class java.awt.Graphics2D (sun.print.ProxyPrintGraphics and > java.awt.Graphics2D are in module java.desktop of loader 'bootstrap') ` > > FIx is made to render Aqua progress bar into BufferedImage, then drawImage > for non-Graphics2D case where 1.1 PrintJob is used > > > > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java line 205: > 203: } > 204: painter.paint(g2, progressBar, i.left, i.top, width, height); > 205: if (progressBar.isStringPainted() && > !progressBar.isIndeterminate()) { You are now drawing this in a potentially flipped context, so you'll get mirrored text. i.e the previous code restored the transform before calling paintString(). Also in the 1.1 case the text will now be very blocky since you are painting into an unscaled graphics. It might be better to move this block back into paint() ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31749#discussion_r3605967002
