views:

202

answers:

2

I have a console application which screen scrapes some data, and now I need to do image comparisons. If the images are different, I want to show the images to the user. What's the best way to display two images during the execution of a console application? I'm assuming I would use some sort of inter-process communication to send information back and forth, but I'm not sure how exactly I would go about doing that in a good fashion.

Also, I'd rather NOT store the images to files if possible. There's no reason to persist the data, and if the console application terminates unexpectedly, it's better if I don't have any dirt left on the file system.

Does anyone have any thoughts on how best to accomplish this?

+3  A: 

I am not sure I understand the concern. You should be perfectly able to conditionally pop up either a Swing JFrame or AWT Frame from your console application, am I wrong?

vladr
Ack. I must have had a brain freeze, or something.
Stefan Kendall
It happens... :)
vladr
+1  A: 

You can use e.g. BufferedImage to construct images, or the utilities in javax.imageio if your image is already in some common format (e.g. PNG, JPEG, BMP). As for displaying to the user, just use the regular Java GUI stuff, either Swing or AWT. Run the GUI in a separate thread if the console part needs to keep processing while the images are being displayed.

The Working with Images tutorial may contain some helpful examples.

Arkku