You can save time and reduce other costs associated with Java development by taking advantage of open source Java projects. In this new series, Jeff Friesen introduces a variety of lesser known open source Java projects that can benefit your Java software. Jeff begins the series by looking at Bernhard Pauler's balloontip project, which you can use to add Windows XP-style informational "balloons" to your Swing-based Java applications.
|Open source licenses|
|Open source software is usually subject to some form of license, which determines how the software can be used. The balloontip project is released under the GNU Lesser General Public License (LGPL). See this article's Resources section to learn more about the LGPL.|
A balloon tip is a small window that presents an informational message to remind or otherwise notify application users of significant events. Its name is derived from the fact that balloon tips have a similar appearance to the speech balloons found in comic strips.
Windows XP supports balloon tips in the context of its taskbar notification area and this area's icons. You can see this in Figure 1, where XP displays a balloon tip above and partly over a notification area icon after something significant has happened.
The balloon tip in Figure 1 is positioned in such a way as to identify its associated notification area icon. The figure also reveals a Close button to close the balloon tip window, and a small "i" icon, which classifies the balloon tip as informational.
Bernhard Pauler's open source balloontip project introduces XP-like balloon tips to Swing GUIs. In this first article in the new "Open source Java projects" series, I'll show you how to obtain and install the balloontip software. I'll also walk you through balloontip's example application, explore the balloontip API, and explain where balloon tips are useful in Swing-based Java development.
Obtain and install balloontip
The balloontip project's Balloon Tips for Java page, hosted on Java.net,
|A shorter path home|
|On my XP platform, |
introduces balloontip. Among other things, you'll find a link to the latest version of the software on this page.
At the time of writing this article, the latest version available is
BalloonTip_2007-05-15.zip. After downloading and unzipping this archive, I discovered a
BalloonTip_2007-05-15 directory containing
BalloonTip as the home directory.
BalloonTip home directory contains
src subdirectories. It also contains
README.txt, which briefly describes how to run the
BalloonTipTestDrive example application. The complete directory structure is shown in Listing 1.
Listing 1. Balloontip project directory structure
BalloonTip classes net java balloontip examples BalloonTipTestDrive$1.class BalloonTipTestDrive$2.class BalloonTipTestDrive$3.class BalloonTipTestDrive.class images closebutton_default.png closebutton_pressed.png closebutton_rollover.png frameicon.png infoicon.gif utils WindowUtils.class BalloonTip$1.class BalloonTip$2.class BalloonTip$3.class BalloonTip.class EdgedBalloonBorder.class RoundedBalloonBorder.class src net java balloontip examples BalloonTipTestDrive.java images closebutton_default.png closebutton_pressed.png closebutton_rollover.png frameicon.png infoicon.gif utils WindowUtils.java BalloonTip.java EdgedBalloonBorder.java RoundedBalloonBorder.java README.txt
classes hierarchy provides Java SE 6-compiled code for the
net.java.balloontip.utils packages. Only the former package and the three closebutton PNG images constitute the balloontip API.
|Make a JAR file|
|Follow these steps to create a JAR file if you find it more convenient to work with a JAR file than a |
src hierarchy provides all source code and a duplicate of the various image files. The source code for the balloontip API consists of
After the archive is unzipped (and
BalloonTip possibly moved to another location), complete the installation by pointing the
CLASSPATH environment variable to the
classes directory (unless you create a JAR file that you specify via the
Test drive balloon tips
The BalloonTipTestDrive example application demonstrates balloon tips associated with a text field component. You should download it now if you haven't already done so. Once you've downloaded the test drive package, specify
java net.java.balloontip.examples.BalloonTipTestDrive to run the program. A GUI like the one shown in Figure 2 appears.