Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to enable the 'Properties' button in Java's cross-platform print dialog

807588Apr 28 2009 — edited Apr 30 2009
I've seen this question posted many times in these forums, but no answers have been submitted.

Setup for a typical java print and display the cross-platform print dialog (code taken from http://www.javaworld.com/javaworld/jw-12-2000/print/listing1_code.html and modified):
import java.awt.*;
import java.awt.geom.*;
import java.awt.print.*;

public class Example1 implements Printable {
	public Example1 () {
		//--- Create a printerJob object
		PrinterJob printJob = PrinterJob.getPrinterJob ();

		//--- Set the printable class to this one since we
		//--- are implementing the Printable interface
		printJob.setPrintable (this);

		PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();

		//--- Show a cross-platform print dialog to the user. If the user
		//--- clicks the print button, then print, otherwise
		//--- cancel the print job
		if (printJob.printDialog(aset)) {
			try {
				printJob.print();
			} catch (Exception PrintException) {
				PrintException.printStackTrace();
		}
	}
}
This will display the Java cross-platform print dialog. However, next to the Printer selection drop-down, there is a 'Properties' button. This button is always disabled. Does anyone know how to enable it? Does anyone know how to get at the printer properties via some other mechanism? FYI: clicking on this button in any other application (word, firefox, non-java apps) shows a dialog from the printer manufacturer.

TIA,
--Kevin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2009
Added on Apr 28 2009
3 comments
339 views