Free Online Courses for Software Developers - MrBool
× Please, log in to give us a feedback. Click here to login
×

You must be logged to download. Click here to login

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

×

MrBool is totally free and you can help us to help the Developers Community around the world

Yes, I'd like to help the MrBool and the Developers Community before download

No, I'd like to download without make the donation

Virtual Screenshot Manager - Searches and Manages all your screenshot at one place

In this tutorial we will see an app called Virtual Screenshot Manager, which is useful for all those who takes a number of screenshots and need an easy and manageable way to handle and search the screenshots.

Virtual Screenshot Manager is an app for all those who take a number of screenshots and need an easy and manageable way to handle and search there screenshots. This becomes very necessary when you got thousands of screenshot and you need to extract any specific screenshot.

The software attached can help you maintain and search your screenshot Gallery. Click on the "source code" button above.

Here I will give you a brief idea on important aspects of Virtual Screenshot Manager.

Brief idea on important aspects of Virtual Screenshot Manager

Figure 1: Brief idea on important aspects of Virtual Screenshot Manager

We take care of part where we take screenshot of our screen

Figure 2: We take care of part where we take screenshot of our screen

Listing 1: Capture Screenshot

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

This will get screen size and capture the screen portion.

You can put a cropped image as shown in downloaded file by tracking the mouse and getting the area selected by user.

This screenshots are saved inside a Gallery folder which is kept inside your home\Virtual Screenshot Manager. The home directory can be obtained using System.getProperty method and user.home as parameter.

Listing 2: Save image

File save_path = new File(Destination+”\\”+GalleryVal+”.jpg”);
        ImageIO.write(img, "JPG", save_path);

This will save the image in jpg format and store in directory destination. The GalleryVal tells the name for the jpg. It would actually be a counter which updates after every screenshot is taken. For next time we update the counter and store that image as 2.jpg and likewis.

After we have saved the image we ask user to tag this captured image. We do this so that user can later search those images by these search tags.

For this purpose we make use of Serialized class and storing the objects in a file.

Listing 3: Image Tagging info

public class ImgDet implements Serializable{
    
    String id,filename,website,name;
    int dlist,dval;
    List tags=new ArrayList();
    String date;

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getDlist() {
        return dlist;
    }

    public void setDlist(int dlist) {
        this.dlist = dlist;
    }

    public int getDval() {
        return dval;
    }

    public void setDval(int dval) {
        this.dval = dval;
    }

    public List getTags() {
        return tags;
    }

    public void setTags(List tags) {
        this.tags = tags;
    }
}

Here:

  1. We make variables like filename to hold the exact filename of the screenshot.
  2. Date is used to track when we took that screenshot.
  3. Website is used to track if any particular website is associated with this
  4. Name is used to search about this image.
  5. Tags is used to tag this image for later search
  6. Dlist and dval are used for tracking of images.
  7. We made a setter an getter for this variables so that we can easily set or obtain the values later.

Now after we got all the info we store it in a file like below :

Listing 4: Storing information in file

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

Here:

  • We store the image information in a db.dat file.
  • Variable al is an ArrayList which we use to store the Image detail object.
  • We write the same in the file and then we close the ObjectOutputStream object so that content gets written in the file.

Gallery :

This will contain all your screenshots and you could search those using only search term.

The concept is we make use of JLabel and show the images by passing image icon.

Listing 5: Showing Gallery image

list1 = new JLabel(new ImageIcon("GalleryPath + “\\”+GalleryVal+ ".jpg"));

Here the GalleryPath will contain the path where you store all your gallery images.

GalleryVal would be a number representing any specific screenshot. Like for first image it would be 1.jpg and likewise. We are doing in this manner since we store the images as 1,2,3,4… as told in Listing 2.

Search Gallery

After we have stored and seen gallery its time we start code to search our gallery. This is simple provided the user have correctly specified the tag information with the screenshot he captured.

Listing 6: Showing Gallery image

           FileInputStream fin = new FileInputStream(fullPath+”db.dat");
            ObjectInputStream ois = new ObjectInputStream(fin);
            List al = (ArrayList) ois.readObject();
            ois.close();
            for (int i = 0; i < al.size(); i++) {
                ImgDet im = (ImgDet) al.get(i);
                if (im.getName() == “flower”) {
                    website = im.getWebsite();
                    date = im.getDate();
                    List tags1 = im.getTags();
                    for (int j = 0; j < tags1.size(); j++) {
                        tags += tags1.get(j) + " ";
                    }
                    break;
                }
            } 

Here:

  • We make an object to read our database file.
  • It read the object and stores it into the arraylist.
  • Now we iterate through the full arraylist to retrieve specific value where name is flower. We assumed that the user has searched for keyword “flower”
  • After we find it we track down, each information linked with it and then store them in variable. You can show this info easily to user making use of any particular JFrame.
  • Make sure you include all validation before you start searching.

To make your application platform independent always make sure that you are using System.getProperty method to obtain user home and separator which will allow your app to run cross-platform.

I have included a copy of my work which will allow you to capture, search and manage your screenshots. You can download and try it out. The application is platform-independent. It would also be great if you can leave me any feedbacks or comments on how this can be better improved to meet all user specific requirements.

This is all for this article. See you next time.



My main area of specialization is Java and J2EE. I have worked on many international projects like Recorders,Websites,Crawlers etc.Also i am an Oracle Certified java professional as well as DB2 certified

What did you think of this post?
Services
[Close]
To have full access to this post (or download the associated files) you must have MrBool Credits.

  See the prices for this post in Mr.Bool Credits System below:

Individually – in this case the price for this post is US$ 0,00 (Buy it now)
in this case you will buy only this video by paying the full price with no discount.

Package of 10 credits - in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download few videos. In this plan you will receive a discount of 50% in each video. Subscribe for this package!

Package of 50 credits – in this case the price for this post is US$ 0,00
This subscription is ideal if you want to download several videos. In this plan you will receive a discount of 83% in each video. Subscribe for this package!


> More info about MrBool Credits
[Close]
You must be logged to download.

Click here to login