Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

JVM Languages

Examining Symantec's Cafe

August 1996: Examining Symantec's Cafe

Examining Symantec's Cafe

Visual development meets Java programming

Anil Hemrajani

Anil currently provides software engineering consulting services to a Fortune 500 corporation in McLean, VA. He can be contacted at [email protected] or via http://www.patriot.net/users/anil/.

caf is a 32-bit stand-alone Java visual- development environment available for both Windows 95/NT and Macintosh OS. caf provides most of the tools we've come to expect from graphical integrated-development environments (IDEs)-project management, wizards, compilers, class browsers, graphical debuggers, color-coded source code, and the like. The Caf Studio resource editor, for instance, is a visual tool that lets you drag-and-drop visual controls onto a Java form. Studio also lets you take existing Windows resource scripts and automatically convert them to Java source code. (For additional information on Caf and how it compares to Java IDEs, such as Rogue Wave's JFactory and Autodesk's Hyperwire, see "Visual Development Tools for Java," by Steve V. Yalovitser, Dr. Dobb's Sourcebook, July/August 1996.)

In this article, I'll examine the Symantec Caf for Windows environment by developing a typical Java applet-a phonebook for retrieving information about a person at a given Web site using his first name, last name, telephone number, fax number, or e-mail address; see Figure 1. Phonebook data is stored in a field-delimited flat file that resides at a Web site, but is downloaded the first time a search is performed. The source code for the applet is available electronically.

Creating Projects

By now, most of us are familiar with IDE "projects" that help manage a set of source files related to a specific task or project. Caf provides two "agents" (similar to wizards) for creating projects-ProjectExpress and AppExpress. ProjectExpress (Figure 2) creates an empty project and lets you include existing Java source files. New source files can be added to, or removed from, a project at any time after its creation. AppExpress guides you through a series of screens (see Figure 3) that create a skeleton project which can be compiled and run without modification. In short, you can use AppExpress to create:

  • An applet that displays the message "A Simple Applet" in the center of the applet's window. The automatically generated files include ProjectName.java, ProjectName.html, and ProjectName.rc, where ProjectName is the name you assign to your project in AppExpress. The ProjectName.java file contains a class derived from java.applet.Applet.
  • A stand-alone GUI application with a File, Edit, and Help menu. The automatically generated files include a ProjectName.java and ProjectName.rc file. The File menu contains menu items such as New, Open, Save, Save As, and Exit. The Edit menu contains items for Undo, Cut, Copy, and Paste. The Help menu contains a single item to display a default About Box. Classes created include a main application class derived from the Frame class, a class for the About box, and another for the Quit prompt box (both of which derive from the java.awt.Dialog class). Additionally, default event handlers are generated to provide functionality for the various menu options and dialog boxes.
  • A stand-alone console application, also known as a "command-line Java program." (See "Java Command-Line Arguments," by Greg White, DDJ, February 1996.) ProjectName.java, the only file generated for this option, contains a class that does not derive from any other class. When executed without modification, the application displays the message "press Enter to exit" and waits for the user to press Enter.
Because I was not sure originally on what type of application to develop, I decided to use ProjectExpress to create an empty project. But just to try out AppExpress, I used it to create a sample applet, GUI application, and stand-alone console application. AppExpress worked fine in creating all three projects, except when I used a hyphen in my project name ("AppExp-Applet"). This resulted in a compiler error. Since hyphens are not allowed in identifiers, AppExpress created a class with the same name assigned to project but replaced the hyphen with an underscore. However, a Java compiler reports an error since it expects a public class to be in a file named "class.java," where class is the name of the public class. To get around this, I recreated my project using the name "AppExp_Applet."

Designing Screens

To design application screens, you use the Studio resource editor to interactively create and edit menus. More specifically, Studio provides two agents-FormExpress for designing forms, and MenuExpress for designing menus. FormExpress lets you visually design a form. When implemented, it generates a Java source file containing a class derived from the appropriate Java system class, depending on the type of application you are working with. The generated source code includes an event handler. MenuExpress, on the other hand, allows you to visually create a menu bar and menu items. When implemented, it generates a Java source file containing a class derived from the java.awt.Frame class. The generated source code also includes an event handler.

One problem I had with these agents was the lack of a Cancel button. This was annoying:When I unintentionally selected these agents, I had to create a dummy form and menu, exit Studio without saving changes, manually remove the generated source files from the project, and manually delete them from my hard drive.

Other Studio features for working with GUI controls include alignment control, centering and spacing controls, grid, font specification, and the like. In particular, I liked being able to add methods to handle specific events directly in the properties window for a given control by simply selecting the type of event and clicking on a button to edit the generated source code. For example, for the Search button in the phonebook applet, I selected the Clicked event and chose an Edit button from the control's properties. This generated a method to handle the event and allowed me to edit the source code in that method.

Another Caf Studio benefit is its use of Windows resource (.rc) files for importing existing .rc files, including those created with Visual Basic, Delphi, and the like. Still, Studio does not support the GridLayout and GridBagLayout layout managers, two of my favorites. Consequently (and because Studio isn't a true WYSIWYG tool), I decided to scrap the generated code and use my own (with the help of GridLayout and GridBagLayout). I would have preferred to use Studio to design my screens, as well as the "as-is" generated code to save development time (Grid* layout managers are a pain). However, the generated screens didn't look the way I wanted.

Views and Workspaces

Caf's Views and Workspaces let you look at your application from different perspectives. A View is essentially a window, whereas a Workspace is a collection of views. Caf provides nine views: Source Editing, Project, Output, Call Chain, Data/Object, Breakpoints, Thread Debugging, Class Editor, and Hierarchy Editor.

While most views are self explanatory, the Class Editor and Hierarchy Editor views (see Figure 4) deserve mention. The Class Editor is a class browser that lets you look at the collection of classes in use by your project, the members for a selected class, and the source code for a selected member in that class. All of this can be viewed within a three-pane, Smalltalk-like window. Additionally, this view lets you add top-level classes, derived classes, new methods or data members, and edit source code for a given method.

The Hierarchy Editor, on the other hand, provides the same functionality as the Class Editor, but with a graphical representation of class relationships (viewed on the screen or printed). The printed output can be handy, especially if you want to understand the hierarchy of Java system classes and see where your classes fit in. Although I didn't use the feature, the Hierarchy Editor does allow you to dynamically create new classes within this object editor.

Workspaces allow you to save task-specific window configurations (size and position). This means, for instance, that you could look at the Source, Breakpoint, Data/Object, and Call windows when debugging, but the Source, Project, Class Editor, and Hierarchy Editor windows while editing or browsing your source code. You can have up to five workspaces; Caf provides four predefined options (Editing, Browsing, Debugging, and Output) that can be altered or deleted.

Building Applications

Caf provides options for compiling individual files, building the application by checking the dates on dependencies, or rebuilding the entire application without checking the dependencies. All compilation output is displayed in the output window, including syntax errors (which can be fixed by either double clicking on the specific error in the output window and going directly to the source code containing the error, or by using the Ctrl-Tab and Ctrl-Shift-Tab shortcut keys to navigate through the errors in the source code).

Symantec claims that its compiler is up to ten times faster than Sun's. Since Caf provides the option to use either compiler, I ran a crude benchmark test and found that, when rebuilding the entire phonebook application, Symantec's compiler was about three times faster.

Executing Applications

Java GUI and console applications are executed using Symantec's Java virtual machine. Applets can be invoked using Sun's appletviewer utility or a Java-enabled Web browser. Applets require an HTML file like Example 1.

When executing an applet or application, the Caf IDE minimizes itself, presumably to provide a clear view of your application. Every time I executed my application, however, Caf minimized the IDE, then restored it before showing me the applet via the appletviewer. In short, minimizing the Studio desktop didn't accomplish much and actually cost me time, since it took longer for the Caf desktop to minimize and restore itself than it did to bring up my applet in appletviewer.

Visual Debugging

Caf's visual debugger is a good tool-once you get your TCP/IP connections straight. Unfortunately, I never did get connections to work perfectly, even after calling Symantec twice. Admittedly, this problem might have been related to how Winsock works on Windows 95 or my configuration.

My connection problem seems to be related to Caf's need for an active TCP/IP stack for debugging. According to Symantec, this requirement is imposed by Sun's Java debugger (jdb), which is used under the hood. If you use dial-up networking (as I do), you must be connected to the Internet to have an active TCP/IP stack. Although the prerelease version of Caf version 1.2 eliminates the need for an active TCP/IP stack, it was not available at this writing. I wasn't about to connect to the Internet every time I wanted to debug my code, especially since I do not get unlimited access from my ISP. According to Caf's online help, the solution to this dilemma is to add a dummy TCP/IP connection with an IP address of, and subnet mask of I did this and, after rebooting my machine, was able to debug my Java programs in Caf without being connected to the Internet. That was great-until I decided to jump onto the Web and do some surfing. That's when I realized that I was unable to connect to the Internet successfully.

The problem this time appeared to be related to the domain name server, since none of my Internet applications could locate any hosts. After several attempts, I removed the dummy TCP/IP component and rebooted my machine and was again able to connect to the Internet. After several retries of adding the dummy TCP/IP component, rebooting the machine, attempting to connect to the Internet, failing, and removing the TCP/IP component, I was convinced that this setup would not work for me. Symantec was not of much help.

Even postings to newsgroups and forums did not yield helpful information. Nor did the Windows 95-generated TCP/IP log file (ppplog.txt) tell me much. According to Symantec, several of its users have the multiple TCP/IP component configurations working (which didn't fix my problem either).

Still, I finally was able to use the visual debugger, which supports features found in most visual debuggers-breakpoints, data watch, step into/over functions, and call stack. Additionally, the debugger provides a window for viewing a program's threads and the associated data, and the call stack for each thread. While most of the standard debugging tools are provided, a couple of key features are missing. For example, since I had to scroll through the data/object window to locate specific variables, it would have been nice to have an "instant variable watch" option to view a specific variable. There was a Show Data option on the context menu for the source window, but it did not appear to do anything, and the online help for this context menu did not match the actual screen, so I could not figure out what this option was supposed to do. Another related problem was the inability to modify the contents of a variable. The online help for the Data/Object window mentioned that you could "examine and modify" a variable's information, but I could not find any help on how to do so.

On the bright side, the look-and-feel of the debugger's user interface blends well with the Caf desktop, and the use of jdb under the hood is completely transparent. The debugger helped me quickly track down a couple of logic bugs in the PhoneBookData class that otherwise might have taken some time to uncover.


Caf is a decent tool, but I couldn't help but think that Symantec rushed it out the door just to be the first on the block with a Java IDE. Still, I liked Caf's class editor, hierarchy editor, drag-and-drop capabilities, workspaces, context-sensitive help, color-coded source code, fast compiler, multiple-edit undo, customization of the Tools menu, macros, and global find. For quickly bringing up a Java app or applet, Caf may be hard to beat.

Figure 1: Sample Java applet.

Figure 2: ProjectExpress.

Figure 3: AppExpress.

Figure 4: Caf Views and WorkSpaces.

Figure 5: Visual debugger.

For More Information

Symantec Corp.

175 W. Broadway

Eugene, OR 97401



Example 1: PhoneBook.html.

<TITLE>Phone Book</TITLE>
<APPLET CODE=PhoneBook.class WIDTH=500 HEIGHT=250>
<B><I>Sorry, you are not running a Java enabled browser.</B></I>

<A HREF="readme">README</A>, <A HREF="PhoneBook.java">Source</A><BR><BR>
<A HREF="mailto:[email protected]">Send me an E-Mail</A><BR>
<A HREF="http://ourworld.compuserve.com/homepages/ahemrajani/ javaapps.htm"> More applets: Demos, online source and downloadable files</A><BR>

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.