> Is there any way to provide a custom print dialog rather than rely upon
> the cross-platform dialogs provided? I have a need to change text and
[quoted text clipped - 3 lines]
> Is there an example or suggestions as to how to override the PrinterJob
> to return my customized print dialog?
Imagine your custom print dialog (popped from an invisible applet)
had two buttons, one which said 'OK' and printed 1 copy of the text,
the other which said Cancel and instead printed *100* copies of the
text (which is all 'important' promotional material - ads).
Can you see now, why you are unlikely to be able to change the
default print dialog with a custom one?

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
Thomas Weidenfeller - 16 Dec 2005 10:07 GMT
>> Is there any way to provide a custom print dialog rather than rely upon
>> the cross-platform dialogs provided?[...]
[quoted text clipped - 6 lines]
> the other which said Cancel and instead printed *100* copies of the
> text (which is all 'important' promotional material - ads).
A couple of things here:
- printing does not have to go through a displayed dialog at all. You
can print without ever asking the user anything
- Not the dialog, but the print job is protected by the security
manager. You can indeed fake a print dialog with a cancel button which
uses PrintJob.setCopies(1000) - if you are allowed to get a PrintJob
The conclusion from these two facts is, that you can simply design an
own print dialog from scratch, and present it to the user whenever you
like. You collect the data from the dialog, configure a PrintJob,
without using ant PrintJob dialogs accordingly and off you go.
If you want to play it more complex, the concrete PrintJob class used
(PrintJob itself is abstract), is specified via the java.awt.printerjob
system property. i haven't tried it, but it should be possible to
implement a subclass of PrintJob from scratch, and use that one to
replace the default implementation. This will get you whatever dialog
you want. But there is really not much to gain doing it this way,
because you can anyhow pop up your own dialog whenever you want.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Andrew Thompson - 16 Dec 2005 11:28 GMT
> A couple of things here:
[snip..]
..but then again, I may have been completely wrong
about that stuff. ;-)

Signature
Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew