javax.print
public class ServiceUI extends Object
ServiceUI
provides a method to create a graphical
print dialog.
The graphical print dialog enables the user to browse the available print services on the system. It provides user interfaces to interact with the most common printing attributes likes specifying the number of copies to print or the page ranges.
The initial appearance of the print dialog as shown to the user may be specified by providing the default selected print service as well as initial values for the printing attributes in the user interface.
Constructor Summary | |
---|---|
ServiceUI()
Default constructor. |
Method Summary | |
---|---|
static PrintService | printDialog(GraphicsConfiguration gc, int x, int y, PrintService[] services, PrintService defaultService, DocFlavor flavor, PrintRequestAttributeSet attributes)
Creates a modal graphical printing dialog at the specified location on
the screen.
|
The dialog will return the user selected print service and the given
attributes set will contain the modified printing attributes. If the
user cancels the printing dialog null
will be returned and
the printing attributes set will be unmodified.
The values of the given attributes set (if not empty) will be displayed initially unless the are unsupported by the print service. If a print service does not support a particular value it is substituted with the default value of the print service.
Parameters: gc the screen to use. null
is default screen. x the coordinate of the upper left edge of the dialog in screen
coordinates (not relative to the parent frame). y the coordinate of the upper left edge of the dialog in screen
coordinates (not relative to the parent frame). services the print services to browse (not null). defaultService the default service. If null
the first of the print services in the services array will be used. flavor the flavours to be printed. attributes the attributes requested. Will be updated
by selections done by the user in the dialog.
Returns: The selected print service or null
if user
has cancelled the printer dialog.
Throws: HeadlessException if GraphicsEnvironment is headless IllegalArgumentException if services is null
or an
empty array, attributes are null
or the given default
PrintService
is not part of the print service array.