1 2 3 4 5 6 7 8 9 10 11 12 13
| // On fait la capture d'écran :
Robot robot = new Robot();
BufferedImage image = robot.createScreenCapture( new Rectangle(java.awt.Toolkit.getDefaultToolkit().getScreenSize()) );
// On récupère la position de la souris :
Point location = MouseInfo.getPointerInfo().getLocation();
// Et on dessine sur l'image :
// (ici un simple carré rouge, mais tu pourrais utiliser une image de curseur)
Graphics g = image.getGraphics();
g.setColor(Color.RED);
g.fillRect(location.x, location.y, 16, 16);
g.dispose(); |
Partager