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.


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.)


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.

9 thoughts on “Build Your Own App : Creating an Image Viewer in Java

Comment on the post

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s