i saw the docs for both .. but found the terms a bit hard to get.
i was hoping to get some simple answers here.

thanks for your time :)

Edited 3 Years Ago by somjit{}

PrintRequestAttributeSet is just an interface, HashPrintRequestAttributeSet is a class that implements PrintRequestAttributeSet.

so i suppose functionally they are the same ?
what is the advantage of keeping one as an interface and another as a class ? why not just keep one ?

so i suppose functionally they are the same ?

No, one's an interface, the other is a class. Definitely not the same. Start with a quick review of this tutorial: http://docs.oracle.com/javase/tutorial/java/concepts/interface.html

The advantage is that the print service needs you to suppy some attributes and by defining that as an interface it leaves you free to implement them however you want (consistent with the interface definition of course). For most applications, where there's no need to do anything special, they provide a "default" implementation of the interface in the form of the HashPrintRequestAttributeSet class that you can use without any further effort.

No, one's an interface, the other is a class.

i did get that part... , i guess the way i asked the question was pretty vauge. my bad.

For most applications, where there's no need to do anything special, they provide a "default" implementation of the interface in the form of the HashPrintRequestAttributeSet class

thanks! that makes things a lot clearer.

however , regarding the attributes , using just printDialog() without any attributes let me edit the print settings by clicking the properties button of the dialog that comes up... however , when i used the HashPrintRequestAttributeSet attribute with the printDialog, the properties button was left dysfunctional. why is that ?

this is what im doing

public void filePrint() {
        PrinterJob printer = PrinterJob.getPrinterJob();
        //HashPrintRequestAttributeSet pAttrib = new HashPrintRequestAttributeSet();// pAttrib inside printDialog() does not give functional properties button  
        if (printer.printDialog()) // without it , however , i do get a functional button for properties.
        { 
            try {
                printer.print(); 
            } catch (PrinterException e) {
                e.printStackTrace();
            }
        }
    }

Edited 3 Years Ago by somjit{}

This question has already been answered. Start a new discussion instead.