RFR: 6328248: JProgessBar doesn't show if printed on paper with PrintJob (1.1 Graphics API) [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Feb 20 09:06:31 UTC 2026
On Fri, 20 Feb 2026 08:53:59 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> `JProgressBar` is not printed if JDK 1.1 printing API is used.
>> JDK1.1 printing API `PrintJob ` doesn't support `Graphics2D`.
>> JProgressBar seems to require Graphics2D as `BasicProgressBarUI` needs Graphics2D to do
>> `g2.setStroke(new BasicStroke(...))`
>>
>> Fix is made to not rely on setStroke for non-Graphics2D printing case and also not to clip progress string
>> Also, a null pagerange check is added for PrintJobDelegate as we reset PageRanges if range is not set so to prevent NPE when "All" is used in print dialog instead of "Pages from"
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Review comment
Horizontal print with fix
<img width="378" height="66" alt="image" src="https://github.com/user-attachments/assets/aaca9387-154d-4b18-b835-d1ba812ac843" />
Vertical print
<img width="62" height="358" alt="image" src="https://github.com/user-attachments/assets/53ba5605-5e17-4d6b-8e4e-c3d2ab23ab2b" />
src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java line 153:
> 151: int dpi = java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
> 152: scaleX = (double) dpi / 96.0;
> 153: scaleY = (double) dpi / 96.0;
Is there any other way to get scale factor that doesn't use AffineTransform?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29752#issuecomment-3932523552
PR Review Comment: https://git.openjdk.org/jdk/pull/29752#discussion_r2832150218
More information about the client-libs-dev
mailing list