1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Print.setAction(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
//recuparation de la taille de l'ecran
Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
int hauteur = (int)tailleEcran.getHeight();
int largeur = (int)tailleEcran.getWidth();
//Création de la capture d'écran
Robot robot = null;
try {
robot = new Robot();
} catch (AWTException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Rectangle captureSize = new Rectangle(0, 0, largeur, hauteur);
bufferedImage = robot.createScreenCapture(captureSize);
graph=bufferedImage.getGraphics();
System.err.println("\n\n\n\n ************************** Ok Capture Ecran **************************** \n\n\n\n");
PrinterJob printJob = PrinterJob.getPrinterJob();
PageFormat format = printJob.pageDialog(printJob.defaultPage());
}
}); |
Partager