Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8203834

Define API to support specifying ownership of print dialogs.



    • CSR
    • Status: Closed
    • P2
    • Resolution: Approved
    • 11
    • client-libs
    • None
    • 2d
    • minimal
    • We are adding new functionality so from a Java SE or even JDK perspective there is no compatibility risk.
    • Java API
    • SE



      Define a new PrintRequestAttribute which can specify the print dialog owner window or on top behavior.


      JavaFX has been using internal JDK API provided for it to be able to specify an owner window, or failing that "always on top" behaviour when invoking the Java 2D PrinterJob's print and page dialogs. This was possible when JavaFX was part of the JDK. Now it is separate, this will no longer work unless applications specify on the command line the export of an internal printing package from the java.desktop module


      When displaying the print or page dialog for a java.awt.print.PrinterJob, the PrintRequestAttributeSet parameter may optionally contain a new DialogOwner attribute which applications can use to specify one of - an owner AWT window - AWT "alwaysOnTop" behaviour.

      Also define an undocumented non-SE interface to be used by JavaFX from native code for supplying a native Window handle for an owner window using JNI.


      Define a new class in package javax.print.attribute.standard :

       * An attribute class used to support requesting a print or page setup dialog
       * be kept displayed on top of all windows or some specific window.

      * Constructed without any arguments it will request that a print or page * setup dialog be configured as if the application directly was to specify * {@code java.awt.Window.setAlwaysOnTop(true)}, subject to permission checks. *

      * Constructed with a {@link java.awt.Window} parameter, it requests that * the dialog be owned by the specified window. * @since 11 */ public final class DialogOwner implements PrintRequestAttribute { /** * Constructs an instance which can be used to request * {@code java.awt.Window.setAlwaysOnTop(true)} behaviour. * This should be used where there is no application preferred owner window. * Whether this has any effect depends on if always on top is supported * for this platform and the particular dialog to be displayed. */ public DialogOwner(); /** * Constructs an instance which can be used to request that the * specified {@link java.awt.Window} be the owner of the dialog. * @param owner window. */ public DialogOwner(Window owner) { /** * Returns a {@code Window owner}, if one was specified, * otherwise {@code null}. * @return an owner window. */ public Window getOwner(); /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. *

      * For class {@code DialogOwner}, the category is class * {@code DialogOwner} itself. * * @return printing attribute class (category), an instance of class * {@link Class java.lang.Class} */ public final Class getCategory(); /** * Get the name of the category of which this attribute value is an * instance. *

      * For class {@code DialogOwner}, the category name is * {@code "dialog-owner"}. * */ public final String getName(); }

      Additionally to the above SE API JavaFX will use JNI to call a private undocumented constructor

      * Construct a DialogOwner that  specifies a non-AWT native window.
      * @param id
      DialogOwner(long id);


        Issue Links



              prr Philip Race
              prr Philip Race
              Kevin Rushforth
              0 Vote for this issue
              2 Start watching this issue