Other GUI classes

We have discussed some of the basic, essential classes in the
waba.ui package. You can certainly guess the uses of checkboxes and
radio buttons. These are standard AWT classes as well, and their
functionality in Waba is no different. However, there are a couple of
classes that you would not encounter in other implementations of Java
for the Palm.

MessageBox is a class which opens a modal window
within another window. From the name you can probably ascertain its
uses. It should be noted that MessageBox is part of
SuperWaba (by Guilherme Campos Hazan), mentioned in last month's
article. You can also create a message box with a number of
buttons on it, such as Yes/No/Cancel. The
getPressedButtonIndex() will tell you which of the three
buttons the user pressed.

The Tab Control allows you to add tabs to a window, thus increasing
your screen real estate. For example, if we were to enhance our
contact manager to be a kind of tool for sales force personnel to use
in tracking prospects as well as current customers, our application
might look like this:

Note that we have broken out some of the interface into a separate
class, Contacts.java. This will be placed inside the
first tab. Setting up the tab interface is fairly easy. We declare a
TabPanel (again, part of SuperWaba), and set its
boundaries, initiate the Contacts object and set its
bounds, then add the Contacts object to the
TabPanel. Finally, we add the TabPanel to
the main window.

The other difference is in the event handling code. We need to
determine which tab we are dealing with using the
getaActiveTab() method. After that, we can proceed with
the processing to add a contact or, alternately, add a prospect.

This gives us a good idea how to set up a user interface in
Waba. You should also look at the API documentation for examples of
those classes undiscussed in this article. For further information on
Waba, please consult the following links.