65.9K
CodeProject is changing. Read more.
Home

Virtual Screenshot Manager

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Jun 6, 2013

CPOL

1 min read

viewsIcon

12250

downloadIcon

231

Captures, searches, and manages all your screenshots in one place.

Introduction

Screenshots are an important way to store important information for future reference. This is easy until the time we have a small number of screenshots. But when you have a large number of screenshots, you would probably like to manage them and find a way to search out any of your screenshots by a simple search. Virtual Screenshot Manager makes this possible.

Gallery

Using the Code

We will now discuss the important part of coding . We start with the main functionality, i.e., capturing the full or cropped screen.

Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
Robot robot = new Robot();
BufferedImage img = robot.createScreenCapture(new Rectangle(size));

Here we take a screenshot. The portion for which we take a screenshot will be described by the var
size.

Now when we have made a screenshot, we save it to a predefined location.

File save_path = new File(imgPath+"1.jpg");
ImageIO.write(img, "JPG", save_path);

Now this image will be saved. When you save the next image, you update the counter so that the next one gets saved as 2.jpg.

Next, we open a popup asking to enter information about this screenshot which we may use to search the image later.

We write all screenshot information as below:

FileOutputStream fout = new FileOutputStream("ImageInfo.dat");
ObjectOutputStream oos = new ObjectOutputStream(fout);
al.add(imd);
oos.writeObject(al);
oos.close();

Here, imd is an object which contains information about the cropped image. We write this inside a serialized class which we can later read to either display or search the screenshot.

Now to show images, we use:

list1 = new JLabel(new ImageIcon(Img + ".jpg"));

This will display a new screenshot. Likewise, we may show the remaining screenshots. For my software, I am numbering the screenshots.

For searching, we give a search term and use it to check the dat files.

Points of Interest

I learned how easy it is to learn NetBeans and it can do wonderful things. This is all from my side for now. Please let me have your valuable feedback.