Browse Home

Build Your Own App : Creating an Image Viewer in Java

Build Your Own App Series is going to showcase some of the applications I built using Java. To Start with, let’s take a look at a simple Image Viewer that opens an image file on your disk and displays it. I also creates previews of the recently opened images, so that you can go back and view them.

SCREENSHOT:

Application uses Java Swing for the basic widgets. I first added preview functionality for only 4 images (a.jpg b.jpg c.jpg and d.jpg in the local folder) and then made another stride forward by giving previews for 4 most recently viewed images as well, using radio buttons. Images of numerous shapes and sizes have been tested, and the viewer is found to be working just fine.

Note: The application does not make use of multithreading and uses only two threads (main and event-dispatching). So there is a limit to the interval of listening to actions. That is, you cannot click vigorously on the previews and in some extreme cases the previews may not be rendered properly if so. (Select default again and select back recent in that case.)

DOWNLOAD PROJECT:

Project Files

Executable jar file

Windows executable (.exe)

So that’s it! We will meet again with another app next time 🙂

Coming up next in Build Your Own App (June 2011) : Rich Text Editor in Java.

Categories: Build Your Own App

Tagged as:

Chinmay Hegde

5 replies

Leave a Reply

Your email address will not be published. Required fields are marked *