if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
PrintRequestAttributeSet attributes =
new HashPrintRequestAttributeSet();
attributes.add(new Copies(getCopies()));
attributes.add(new JobName(getJobName(), null));
boolean doPrint = printDialog(attributes);
if (doPrint) {
JobName jobName = (JobName)attributes.get(JobName.class);
if (jobName != null) {
setJobName(jobName.getValue());
}
Copies copies = (Copies)attributes.get(Copies.class);
if (copies != null) {
setCopies(copies.getValue());
}
Destination dest = (Destination)attributes.get(Destination.class);
if (dest != null) {
try {
mDestType = RasterPrinterJob.FILE;
mDestination = (new File(dest.getURI())).getPath();