Pessoal vejam o codigo, o erro que me dá é o seguinte : unreported exception java.awt.print.PrinterException; must be caught or declared to be thrown.
O que devo fazer para resolver isso e imprimir a minha tabela ?
try {
Printable printable = table.getPrintable(JTable.PrintMode.FIT_WIDTH,
new MessageFormat("My Table"),
new MessageFormat("Page - {0}"));
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(printable);
PrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
// display a print dialog and record whether or not the user cancels it
boolean printAccepted = job.printDialog(attr);
// if the user didn't cancel the dialog
if (printAccepted) {
// do the printing (may need to handle PrinterException)
job.print(attr); //ERRO : unreported exception java.awt.print.PrinterException; must be caught or declared to be thrown
}
} finally {
}
