On Sun, 19 Jul 2026 09:01:11 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). > > Prasanta Sadhukhan has updated the pull request incrementally with one > additional commit since the last revision: > > Move paintString block to paint Changes requested by prr (Reviewer). src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java line 191: > 189: > 190: private void paintProgressBar(Graphics2D g2, Insets i, int width, > int height) { > 191: // this is questionable. We may want the insets to mean > something different. This comment applies to code in the paint() method. Maybe this confusing the context is part of why the diff here is showing the paint method as moved .. making the diff less natural. src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java line 227: > 225: g2d.fillRect(0, 0, width, height); > 226: paintProgressBar(g2d, i, width, height); > 227: if (progressBar.isStringPainted() && > !progressBar.isIndeterminate()) { I wasn't expecting to see this call twice now, and more of a concern it is still not right. In this case the text is still painted blocky because you are still drawing into the BI, the only thing that is fixed is that it is no longer mirrored. This call should only be made in one place and it should be immediately before returning and look like if (progressBar.isStringPainted() && !progressBar.isIndeterminate()) { paintString(g2, i.left, i.top, width, height); } I think you need to enhance the test to draw the progress string - and also test with an RTL component so we can prove this all works and renders in the right place too .. ------------- PR Review: https://git.openjdk.org/jdk/pull/31749#pullrequestreview-4748378135 PR Review Comment: https://git.openjdk.org/jdk/pull/31749#discussion_r3625155301 PR Review Comment: https://git.openjdk.org/jdk/pull/31749#discussion_r3625229755
