Bonjour,
mon problème est simple, je voudrais faire un menu pour imprimer un JFrame contenant un composant JFreeChart et un tableau. j'ai essayé ce code la mais j'ai eu un message d'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
Properties props = new Properties();
props.put("awt.print.paperSize", "a4");
props.put("awt.print.destination", "printer");
PrintJob pJob = getToolkit().getPrintJob(this,"impression "+this.getName(), props);
Graphics pg = pJob.getGraphics();
printAll(pg);
pg.dispose();
pJob.end();
le message d'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.print.ProxyPrintGraphics cannot be cast to java.awt.Graphics2D
Pouvez vous m'aider? Merci!