public void printPage() {
try{
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.pageDialog(printJob.defaultPage());
printJob.setPrintable(this, printJob.defaultPage());
if(printJob.printDialog()){
printJob.print();
}
return;
}
catch(PrinterException pe) {
EuamAppletLogger.error(pe, "Exception Caught");
}
}
/**
* Prints the page at the specified index into the specified Graphics context in the specified format.
*
* @param g
* @param pg
* @param page
*
* @return int
*/
public int print(Graphics g, PageFormat pg, int page) throws PrinterException {
Graphics2D g2 = (Graphics2D) g;
if (page >= 1)
return Printable.NO_SUCH_PAGE;
g2.translate(pg.getImageableX(), pg.getImageableY());
paint (g2);
System.gc();
return PAGE_EXISTS;
}
this code pops-up 'An applet would like to print. Do you want to continue?' but the browser just hungs there. I am not able to click on yes/no option. Any thought?
Thanks