[OpenJDK 2D-Dev] RFR: 8203796: Define API to support specifying ownership of print dialogs.

Phil Race philip.race at oracle.com
Fri May 25 18:04:12 UTC 2018

This defines a new class "DialogOwner" implementing PrintRequestAttribute
which allows an application to specify that a Print or Page dialog be  
one of
1) owned by an application specified AWT window
2) owned by an application specified foreign (non-AWT) window
3) use AWT's alwaysOnTop functionality where supported.

JDK bug: https://bugs.openjdk.java.net/browse/JDK-8203796
CSR : https://bugs.openjdk.java.net/browse/JDK-8203834
JDK webrev : http://cr.openjdk.java.net/~prr/8203796/

Please review the webrev and the CSR.

The webrev will show that this functionality was already mostly 
available but only as internal API.

To help applications be able to query what is supported, the various
PrintService implementation classes needed to be updated, for example "ID"
is reported as unsupported unless specifying using the native dialog on 
That actually pointed out that back in JDK 7 when we added 
to be able to choose native or Swing there was no query support for that 
to be
added. It was not a problem though as if it was not supported it really 
just meant
that applications would have to live with what dialog was provided, as 
But it made a test for this new API more difficult .. so I added code 
needed for that.
The test is manual. An automated test might be possible, but probably 
very flaky.
But the test only makes you run through the scenarios that we know are 

The motivation for this new public API is to help OpenJFX since it uses 
the Java 2D PrinterJob class
to implement its own printing, so there is also an FX side to switch to 
using this instead
of the earlier internal API which it can not access when it is outside 
the JDK :

FX bug : https://bugs.openjdk.java.net/browse/JDK-8195808
FX webrev: http://cr.openjdk.java.net/~prr/8195808/


More information about the 2d-dev mailing list