Name: rl43681 Date: 06/17/2003
A DESCRIPTION OF THE REQUEST :
The javax.print.ServiceUI.printDialog method requires x and y coordinates, forcing application writers to arbitrarily place a dialog whose size is unknown. A second printDialog method is needed which takes a Component instead of x and y coordinates. The printDialog method could use that Component to place the dialog it creates, much like JOptionPane does.
The javax.print.ServiceUI.printDialog method takes, among other things, a GraphicsConfiguration and x and y coordinates as parameters. However, in most cases, I want the print dialog to be displayed so that it is centered over the window whose controls were used to invoke the print dialog (that is, the window containing the "Print" button or menu item). Since I have no way to determine the size of the dialog ServiceUI.printDialog will display, I cannot effectively center it. In fact, I have no way to determine "good" (aesthetic) x and y values; the best I can do is have my code act like a simple-minded window manager and add an arbitrary number (like 30) to the x and y of the "parent" window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I would like to see a method in javax.print.ServiceUI with a signature like this:
public static PrintService printDialog(
The dialog it creates would then be placed using Window.setLocationRelativeTo (just like JOptionPane). Notice also that there is no need for the GraphicsConfiguration parameter, since it can be obtained from the Component.
CUSTOMER SUBMITTED WORKAROUND :
private void printData()
// Just guess at x and y by adding 30
PrintService selectedService = ServiceUI.printDialog(
this.frame.getX() + 30,
this.frame.getY() + 30,
if (selectedService != null)
(Review ID: 186949)