Popup menus, the extremely functional components available to the Java
developer, allow developers to provide menu capability without the inclusion
of a full-blown menu system (i.e., MenuBar, Menus). From a user interface
perspective, however, they're not intuitively accessible. The popup menu is
usually triggered by pressing the right mouse button, but users may not be
aware of its availability.
This article details a PopupButton component that ties the popup menu to a
button component and allows users to display the menu via a click of the
PopupButton.
Class Design
The PopupButton component is made up of one abstract class, PopupButton,
located in PopupButton.java (see Listing 1). This class extends the
java.awt.Button class and implements the java.awt.event.ActionListener event
listener interface. Since the class is abstract, the
java.awt.event.ActionListener i... (more)
A tip window (also known as a tool tip window) is a small popup window that
displays a single line of descriptive text. Tip windows are usually displayed
over toolbar buttons to provide textual help about a toolbar button's
functionality. The tip window control is available for Swing components via
the JComponent class's setToolTipText() method; unfortunately, the AWT
doesn't have an equivalent control at its disposal. This article details the
classes that constitute my implementation of an AWT tip window control.
Implementation
The tip window control is made up of two classes, Ti... (more)
File searches are traditionally accomplished by an operating system utility.
Most operating systems provide some sort of search facility that allows the
user to track down misplaced or forgotten files. However, the facilities
differ in their approach for searching files graphical versus command-line
interface, comprehensive versus limited search capability.
If you work in multiple environments as I do, you become reliant on search
functionality available in one environment that may not be supported in
another. This article details a Java file search utility that provides a
con... (more)
How do I disable a Frame's Minimize and Maximize buttons? How do I obtain the
amount of a drive's free disk space? How do I retrieve the window handle of a
Java Frame? How can I read the label of a disk drive? These and other similar
questions are quite prevalent on the Java Usenet newsgroups. The answer to
these questions is always the same: you need to use the Java Native Interface
(JNI). These types of questions are so commonplace (not only in the
newsgroups) that I decided to provide the answers in the form of a
Windows-specific Java utility class written with the help of the... (more)