1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public class ActionImprimer implements ActionListener{
public void actionPerformed(ActionEvent e){
PrinterJob printJob = PrinterJob.getPrinterJob();
PageFormat pageFormat = printJob.defaultPage();
//printJob.setPrintable(editeur,pageFormat);
if (printJob.printDialog()){ // le dialogue dimpression
try{
printJob.print();
}catch (PrinterException exception){
JOptionPane.showMessageDialog(new JOptionPane(),"erreur Impression : "+exception.getMessage(),"Erreur",JOptionPane.ERROR);
}
}
}
} |
Partager