We’re sorry. We could not find a match for your search.

We suggest you try the following to help find what you’re looking for:

  • Check the spelling of your keyword search.
  • Use synonyms for the keyword you typed, for example, try "application" instead of "software."
  • Start a new search.
Cloud Account Sign in to Cloud
Oracle Account

The Overlay Maker: Making the Most of Swing and Java2D

By Alistair Dickie, January 2007

If you are a developer who uses Java SE technology, we invite you to share your development experiences, challenges, and success stories. Send us your story, and share it with your fellow developers. Alistair Dickie is an Australian Army Officer who wanted to draw on maps and ended up creating a networked interface for collaborative planning (real-time drawing updates across a network). Here's his first-hand account.

I have too many hobbies. Messing with Java technology is one of them.

My Java Development Kit 6 (JDK 6) story starts a few years ago. I made a drawing component for another application I was working on (at the time in JDK 1.4). I was pretty happy with some aspects of it but the performance was terrible, mostly because of my dodgy programming skills. You can still find it at JImagePaint and it is listed as a community.java.net project. It actually is not too bad in JDK 6, but that is not the focus of this story.

The Overlay Maker

In my real job, I am an Australian Army Officer, which has nothing to do with programming. If it were not for the relative simplicity and robustness of the Java language, I would not be able to straddle the fence with a foot in both the military and software development camps.

For many years, I have seen a need for a simple graphics program to support operational planning. We have many software tools to do this but very few are simple, and most were written by people that do not really understand our requirements. For what I envisaged, we just wanted to draw on a map, or any other image and not be restricted by what the program could deliver.

With a relatively quiet year for me in 2006, I took JImagePaint and bits of a few other unrelated projects off the shelf a couple of months ago and started hacking in the evenings. The resulting Overlay Maker looks nothing like the original.

Illustration 1: The Overlay Maker
Illustration 1: The Overlay Maker Example Output
here for a larger image

I won't describe The Overlay Maker in detail. Rather, I invite you to download it and try it out. Read the Help file after you have done the installation for a quick introduction. It is basically a drawing program that is geared towards military operational planning, although I and other beta users have applied the application to general drawing needs. We have even used the networked drawing and chat functionality to play board games such as Chess.

How JDK 6 Affects The Overlay Maker

So why is JDK 6 so important for The Overlay Maker? In three words: Performance, performance, performance. JDK 6 provides so many performance improvements in the Java 2D API, it enables applications such as mine to be more powerful.

To begin, the nifty splash screen makes the application look more polished at startup.

The Direct3D acceleration of 2D graphics means that I can get my military mates to run the application on low performance government-issued laptops that do not have any hardware OpenGL acceleration, and it still looks good. If you have a semi-modern computer with a half-decent OpenGL card, then the graphics rock.

Try opening the woodhill.jpg map (this is the default one) and adding a few hundred icons: Drag them from the custom JTree on the righthand side, then select and paste heaps. Make the icons semi-transparent and drag the map around, the image is still smooth!

Swing is quicker too -- a short comment but an important one.

Other additions in JDK6 that I appreciate include: Swing Worker (makes threading easier); a GIF writer (nice that it is included by default; ImageIO keeps getting better); and the ability to be manipulate more File attributes. These are the improvements that come to mind; I am sure there are many others under the hood that just make Java technology better.

And Finally...

The Overlay Maker provides a simple networked interface for collaborative planning (real-time drawing updates for all in the network). This is not really a JDK 6 thing, it is just really cool that Java technology makes it easy to network.

Thanks guys.

For More Information

About the Author

Alistair Dickie, Canberra, Australia, is an officer in the Australian Army.