Visual Development with Java: A Review of Visaj
by Ryan Steckel, J&J Computer Consulting Programmer/Analyst

Introduction

A friend of mine who has never programmed more than an occasional macro was convinced that programming would be replaced by visual building typetools once he saw a visual builder. Seeing the ease of dragging and dropping components to build a functional application seemed like the future tohim because it was so easy. However, I feel visual builders won't replace programming, but instead enhance it. Visual tools are great for the visualpart of an application. With a standard API such as Java's Abstract Window Toolkit for GUI components, most programmers can quickly grasp the concepts of visual tools allowing them to quickly create cross platform applications.The best tool I've found for visual development on Java is Visaj.

Background

Visaj is a GUI Development Environment by Imperial Software Technologies. I like it because it allows me to quickly create effective GUI's. It's not perfect, but it is one of the better Java tools I've seen. The fact that it is 100% Java is what first caught my interest. With OS/2 as my development platform, the ability to run under OS/2 is extremely important. I have been getting quite used to a good editor and command prompt forJava development, but now I use Visaj to build a user interface when needed.

The only downfall of Visaj as an OS/2 application is in its piracy protection. The folks at Imperial Software Technologies decided to create an authentication program only for Windows and Unix leaving OS/2 out. For the evaluation, this doesn't matter. You use Imperial's own authentication server, but when you purchase and use the application yourself, you will need a Windows or Unix system to run the authentication server.

Starting

You are probably wondering where and how to get Visaj. A fully functioning trial version can be found at www.ist-inc.com. You must register with the company. Within a few days you will be sent an e-mail with download instructions. Once you have the distribution, unpack it to a directory of your choice retaining the directory structure. Before you register, however, make sure you are ready to handle several sales calls and/or e-mails.

Visaj has nice installation programs for Windows and Unix. If you are onanother platform, though, you must make some simple modifications. On OS/2, you must set the classpath environment variable and the load the program. To do this, I created a file named Visaj.cmd that included thefollowing command:

        java -Dvj.rootDir=D:\visaj -classpath
              D:\visaj\visaj.jar;%CLASSPATH%com.pacist.visaj.AWTClassApp
This sets the root directory variable to D:\visaj, the directory into whichI unpacked Visaj. It also loads the AWTClassApp class in the com.pacist.visaj package. Note that the classpath could have been set through the config.sys if preferred, however,the classpath can get long and unmanageable given the number of Java applications that require changes to it. The easiest way to handle these applications is to set the classpath when executing the program either through a command file or through theparameters field of an program object on the desktop.

This should bring up the Visaj splash screen and ask for authentication.Visaj uses a detailed authentication system requiring a simple authentication server. For evaluation purposes, use Web Authentication. This requires a key which should have been sent along with the distribution. Once a license is purchased,authentication is done locally.

By now, Visaj should be up and running. If not, Visaj has some documentation provided to help with any problems. Technical support during the trial periodis also very good.

Using Visaj


As with most new applications,it is a good idea to go through the tutorial. When a tutorial is provided, it usually covers the main parts of the application and gets you familiar with how best to use the program. Visaj's tutorial does just that. It introduces you to the heart of Visaj, the Class Editor. There you can createa new Class, Project, or Resource Bundle. I found the Project functionnot to be very useful. The Resource Bundle is for creating Internationalized applications which I have not yet needed.

Before jumping into Visaj, you should be aware of how Visaj functions. Visaj, like most Java visual building tools, relies on Object Serialization to store the classes you create. It has a dynamic display of the class you are designing which allows you to see the changes you make as theyare applied. When you close the class you are working on, Visaj uses Java's Serialization feature to write the class to a file. This is the .vcl file. Java code is not generated until you select "Generate Java"from the "Generate" menu.

The generated code is 100% Java. It uses no additional, proprietary classes. Only the core classes in the Java API (unless you uses IST's components).IST (Imperial Software Technologies) recommends extending the class generated by Visaj to add additional code. For one reason, the generated code is covered with comments allowing the code to be updated instead of creatinga new file each time. It is possible to manipulate the generated code, but you must add code outside of the generated comments or it will be lost when the code is updated. Another reason to extend the class thatis generated is the ability to add local variables. There is no way to add local variables in Visaj (although it is planned for future versions).

The Class Editor starts with a fresh untitled class. From there you can extend a class or add components to the existing one. To customize and name the class select "Properties" from the "Class" menu. There you can extend or implement a class. You can also specify the accessibility of the class (ie. public, private, or protected ). The "Package" tab inthe Class Properties menu will allow you to specify which package thisclass should belong to as well as which packages to import.

Two major components within Visaj's Class Editor are the Layout Tool and the Event Editor. Visaj has the most straight forward and easy to use Layout tool I've seen. GridBagLayout can be quite a pain, but IST did agood job of simplifying it. Using the Class Editor, components are added to the class without any regard for where they go. Then using the LayoutEditor, you can drag the components to the right locations. Once all the components are in the correct location you can specify the GridBag Constraints. This simple design is the main reason I like Visaj. The other layouts are fairly simple. BorderLayout is also manipulated by dragging components to the desired location. FlowLayout is not editable in the Layout Editor because the components are arranged as they are added.

The Event Editor is also very straight forward. Events can be "wired" together simply by holding control and drawing a line between components. This will bring up the Event Editor dialog. In the Event Editor dialog the methods will be displayedfor the source component generating the event as well as the methods of every component in the class. So when one component fires an event, any method of the components added can be called. You can also create new methods yourself add call them when an event is fired.

Problems

Visaj does have it's problems. The dynamic display sometimes isn't so dynamic. Occasionally it has trouble repainting itself. I am usually able to force a repaint by dragging it or placing another window over it. This seems to be a problem common to most visual builders and may be due to slight differences between Java implementations on different platforms.

Another small problem was a blank line between comments added to my source every time the source was generated. With the addition of the blank lines, the source increased by as much as fifty lines.

Visaj was also a little confusing to manage files with. As I said before,the .vcl and .java files are saved to certain locations and updated from there unless specified elsewhere. If you press the "Generate Java"button, it updates the .java file in the present location. This is different then selecting "Generate Java" from the menu which allows you to specify a new location.

Conclusion

Visaj runs surprisingly fast for a visual builder, especially one written in 100% Java. Overall, Visaj is the best visual tool for Java I've seen, and I spent quite a while researching visual tools. Visual programming definitely has its place in Java. The success of JavaBeans is ensuring that visual tools will only get better and better. 

Copyright © 1998 J&JComputer Consulting
All rights reserved.