erms 0 Newbie Poster

Hello,
This is what I'm doing:
1. Get an image from a source
2. Get mouse position
3. Put a mouse Image on original image
4. Resave

The code to get the image is working and saving it the "first" time
But the code after that seems to not work at all. No errors, no exception message, nothing, just not executed.

I know this because the code below deletes the original file once, and resaves. I did not resave it (to test), but it was still there.
Plus the println also does not say anything.

What is wrong here?
Thanks

import java.awt.*;
import java.io.*;
import javax.imageio.ImageIO;

public class SC {

public SC( String uploadPath, String filename){

try{
//get an image and save it
ImageIO.write(capture, mode, new File( uploadPath, filename));
isSuccesful = true;




//put mouse and resave


PointerInfo a = MouseInfo.getPointerInfo();
Point b = a.getLocation();
int x = (int) b.getX();
int y = (int) b.getY();
System.out.println( x+ " " +y );

//String url= uploadPath + filename;
File url = new File( uploadPath, filename);
BufferedImage im = ImageIO.read(url);
url.delete();
String url2= "pointer.png";
BufferedImage im2 = ImageIO.read(url2);


Graphics2D g = im.createGraphics();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
g.drawImage(im2, 1000, 300, null);
g.dispose();
ImageIO.write(im, mode,  url );

}catch( Exception ee ){ ee.printStackTrace(); isSuccesful = false; }


}//SC
}//class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.