© 2000-2003 A-Square, Inc. Cambridge, MA
This exercise introduces you to Rart®.
In Exercise 1, we considered a fairly large Java Applet that did, in one class, everything we wanted.
In Exercise 2, we split up the Java program in parts. One part had to do with the execution and display, that was Banner2. We then considered an abstract class Logo which generalized or abstracted the properties of all logos that we could conceive of floating around the screen of a Banner-like applet. We saw how any derived class, as for example the ASquareLogo and the IEEELogo, was relatively simple. The work involved in the derivation was easy since we could concentrate on the features that made a specific logo unique. It would be a simple matter to plug any logo derived from the Logo class into the Banner applet.
In Exercise 3, we will consider Rart which is a system that is intended as a framework for the development of graphically interesting dynamic art. Compared to Exercise 2, we have now removed from Banner many of the aspects having to do with execution. They end up in the rartrunner class and what remains in Banner3 is that which is specific to a Banner universe. The terms will be elaborated on but for now you should consider the abstract class Universe:
There exists an abstract class Universe (capital U) from which any Rart universe (lower case u) is derived. Any Rart universe is executed (just as any logo is displayed in the Banner2 case through a descendant displayed in the Banner applet) in what is called a rartrunner. There are different versions of rartrunners but in this exercise we are working exclusively with the rartrunner RRL, which is an applet that runs in the Applet Viewer as well as in any Java enabled browser.
In Exercise 3, we are considering a very simple Rart universe. We call it Banner3. We have designed a number of relatively minor variations to allow you to see for yourself how a Rart universe can be modified.
We also refer to Comments to the Code for Banner3
How to do Exercise 3
What you should See
Exercise3a. A Single Logo
Exercise3b. Multiple Logos
Exercise3c. Timing
Exercise3e. Multiple kinds of Logos
All exercises involve the three steps of making a Java applet. You might like to complete the four folders named MyEX3a, MyEX3b, MyEX3c and MyEX3d. The should all have the sourcecode, the HTML startups, and the two scripts CompAnyJava and RunAnyApplet appropriate for your platform.In addition, you need some classes that are relevant to Rart. These you will have to get on the RART CD, until such time we decide they can be downloaded freely from the Rart web site.
For Exercise 3, you need the package rartbase, a java package with the following classes: AboutDialog, Debug, RR, RRL, ShowTextCanvas, Universe, uParameter. Eventually we shall explain the functions of all of the classes. For now, you should know that the rartrunner we use in Exercise 3 is RRL (RartRunnerLight, which is suitable for including an applet on a web page). RRL descends from RR, the mother of all rartrunners, which descends from Applet. For the purpose of Exercise 3 we will include a folder with the package in each MyEX3x folder. Later, in Exercise 4, we shall see how to avoid this duplication and, by using jar-files, greatly increase the speed of the applet download.
The startup HTML for a Rart universe has a form different from that of a plain applet. When you run a Rart universe under a rartrunner applet such as RRL, the HTML startup invokes the rartrunner. The following is the applet tag for GoBanner3a.html in Exercise 3a:
<APPLET CODE="rartbase.RRL.class" WIDTH="390" HEIGHT="114"
ALIGN="MIDDLE" HSPACE="2" VSPACE="2" ALT="( With a java enabled browser you
would see animation here)">
<PARAM NAME="UNIVERSE" VALUE="Banner3a">
</APPLET>
Note, that we have to reference RRL as rartbase.RRL.class since the RRL.class is part of the package rartbase. Also, we give the name of the universe as a parameter. As we shall see, we can also in the startup applet tag give values other than the startup default values for any uParameters defined for the universe.
In all of these exercises you work with variations of a Rart universe named Banner3. For Exercises 3x, x = a,b,c,or d, you should have in the appropriate folder MyEX3x the source Banner3x.java, available as a source files in Banner3a-source.html, Banner3b-source.html, Banner3c-source.html, and Banner3d-source.html. In addition to the Banner3x universe itself we need for all exercises identical versions of the abstract class Logo and the class ASquareLogo, descended from Logo. These can be found in Banner3-source.html together with a copy with comments referencing the different Banner3x versions(cf. Exercise 2). For EX3d, you need in addition IEEELogo descended from Logo. You can study the source on IEEELogo.
Note: For Exercise 3d, you also need the IEEE logo gif-file.
Execute the CompAnyJava script.
Do this for all exercises.
a. Execute the RRL applet by running the browser through the GoBanner3x.html.
b. Execute the applet in the appletviewer by executing the RunAnyApplet script
Do this for all exercises.
One thing you can not do with Banner3 is to stop the logo by clicking. In itself it might be possible to program such an effect into the RartRunners. However, as you will see when we study the RartRunners in more detail, the single short click is reserved for something else. In RRL, a long click will show the About Dialog and a double click will step the current value of a uParameter. In RRlet, as we will see in Exercise 4, a long click will initiate a series of dialogs that allow the observer to select the About Dialog or change any uParameter.
The first example is Banner3a, functionally and visually similar to Banner2a from Exercise2. except that we also diplay some information about the execution enviroment.in this, as well as in the other Banner3x universes. See the Banner3a universe execute by clicking on the link above,
Instead of a Single ASquareLogo we now have several. If you double-click on the applet, the number of logos will increase by one until maximum of 10 when a double-click will change the number to 0. This is a particularity of the RRL rartrunner. If you do a long click, you should see a short description of the universe.
A real problem with running the same code on different platforms is timing. How do you ensure that things move with similar speed if the platform is different? Banner3 has here been modified to provide some data related to the execution of itself. It is especially interesting to see what happens when you execute the same universe with another browser.The Banner3 universe can be seen with browsers as old as Netscape 3 or Internet Explorer 4.0. Try it! Try it also on your Macintosh! and on AOL. You may be surprised at what the executing system tells about itself.
It takes a few lines of new code to include also an IEEE logo in the Banner3 universe. The new code instructs the rartrunner to provide a gif-file. In contrast to Exercise 2b, we are now using the applet RR ( and her decendants) to import files such as the gif-file with the IEEE Logo and so we can now view this universe over the Internet without violating any security. We have also included an image processing method that changes the background color of the logo from white to transparent.
As an openended exercise perhaps you would like to make your own banner universe. You could use the results from the Exercise 1, where you were asked to modify the drawLogo method to make it more meaningful to you and yours.