Uploaded in February 2014 to www.rart.com/InternetJavaIntroduction.html
The
Rart software consists of the software that enables the
development and execution of
Rart universes. This software is fixed as to general
functionality
and is common for all Rart. In addition, the Rart software
consists
of the programmed universes themselves. Each universe is
different,
but all universes have to conform to certain rules defined in
the
common software. We shall here briefly describe the two types
of
software. The main purpose is to give an understanding of the
software. An additional purpose is to give a background to the
Rart
system's adaptation in 2014 to the changes to Java practice which resulted
from the discovery of security problems with the
Java execution environment on the Internet.
The common software defines the rules for a Rart universe and enables the execution of a Rart universe programmed in Java and compiled. In terms of Java, a Rart universe is a class that conforms to a specification given in the common software (technically a Rart universe implements the abstract class Universe). Execution of a coded and compiled Rart universe takes place in one of two modes. It can be executed in applet mode or in an application mode. The class that executes a Rart universe is called a rartrunner.
The basic rartrunner is RR (RartRunner). It has the ability to start up a universe given the name of a universe class as parameter.
Next rartrunner is RRL, (RartRunner Light, RRL extends RR). RRL adds to RR the ability to accept preset value of parameters. It is used in practice to display a universe on a web page. As an example, look at the following part of an HTML page:
<applet
archive="a2banner.jar" code="rartbase.RRL.class"
width="390"
align="middle" height="114">
<param
name="UNIVERSE" value="A2"></applet>
This is a simplified version of the invocation of the applet banner that introduces the Rart home page and shows the A-Square logo floating in the applet window. The universe, called A2, is given as a parameter to the rartrunner RRL. The banner is presented with fixed height and width and little opportunity for observer interaction. (However, a long click on the box gives an About dialog and two short clicks increases the number of floating logos modulo 5!).
The next rartrunner is RRlet (RRlet extends RRL). RRlet offers the user pop up menus to modify parameters. It is an applet and works in the old sandbox with no capability to use the resources of the client computer. RRlet is initiated on a web page with the name of the universe as a parameter.
The final rartrunner is RR11 (RR11 extends RRlet). RR11 is an application executing on the user's computer. RR11 opens with a file dialog which presents the user with a list of available universes. This list is made up of entries consisting of of two items; a textile with the name of a universe and some text. The second item is the compiled class with the name of the universe. Suppose you have compiled a Rart universe, say MyUniverse. The two items in the folder are then MyUniverse.class and the textile named MyUniverse.unv. Selecting the universe, (by selecting the entry MyUniverse.unv) initiates the execution of this universe. The behavior of the universe is identical whether it is executing under RRlet or under RR11. The user interface is also identical except that RR11 may use the local resources including memory and printing facilities. The observer can in the application mode stop the executing universe and save up to five views for later review and possibly printout..
A Rart universe has to conform to to certain rules in order to become executable under a rartrunner. Java provides the mechanism for giving such rules through the ability to define a Java class as abstract. In the definition of an abstract class the common behavior of all universes is defined. In addition, methods, called abstract, may be defined to its signature (type, name and parameters) The body of an abstract method is left to the programmer. In Rart, the abstract class Universe specifies a number of abstract methods. Especially important for the the Rart system of programs are the two abstract methods init and cycle.
public
abstract class Universe extends Component{
.
. .
public
abstract void init();
.
. .
public
abstract void cycle(Graphics g);
.
. .
}
The programmer or, as we like to say, the rartist, implements the abstract methods using init to set the initial conditions and cycle to repeat forever showing changed views using the Graphics context g. When you are a rartist, you will start by programming your particular universe as follows:
Here we shall, describe the concept of universe parameters which are instances of a particular Rart class, that of the uParameter. uParameters provide the mechanism whereby an observer may change the behavior and look of a universe. There are a total of ten uParameters available for a universe. Two are used for all universes, one, named windowsize, to communicate changes in windowsize and one, named cycletime, is used to vary the cycletime, that is the time between two successive executions of the cycle method. In addition, eight uParameter variables are available for the rartist who defines the name the user sees and how the parameter may be varied. There are actually two kinds of uParameters, one where the parameter assumes integer values and one where the observer may select items from values defined in a list of strings. Example of the former is the uParameter cycletime where the rartist gives minimum, maximum, and default values and the uParameter color which is used in some universes to allow selection of color, for example, from a list of the names of the standard Java colors.
uParamaters are set initially to the default values of the universe or as initial values for the applets, rartrunners RR, RRL, or RRlet, or as parameters for the rartrunner application RR11. The uParameters may be varied by the observer using equivalent pop up menus for the universe running under the rartrunner RRlet (applet) or RR11 (application)
Given Universe as a general pattern for a universe with total flexibility in the definition of the init and cycle methods and he ability to define uParameters, we believe we have a good framework for the creation of random art.
The structure defined above shows that certain Java classes are needed for the execution of a Rart universe. For the development and deployment other classes are needed. The common software is organized as follows in three packages: rartbase, rartlet and rr11. We will here describe the function of each package and for completeness enumerate their content.
rartbase includes the simple rartrunners RR and RRL. It also includes the abstract class Universe which, in addition to the abstract init and cycle methods, sets the framework for the parameter mechanism. The package also includes the Debug class which provides trace output to aid the rartist in universe development. Finally the package provides classes for output including AboutDialog and ShowTextCanvas for consistent output of text. The following is a partial listing:
rrlet includes the most complete applet rartrunner RRlet and a number of classes having to do with the selection and processing of uParameters. It includes, with some classes in rartbase, all classes needed to execute a Rart universe as an applet. It's classes include in part:
rr11 includes, with some classes in rartbase and rrlet, all classes needed to execute a universe as an application. There is the rartrunner RR11, and it's classes to deal with uParameters ( Although very similar to the corresponding classes for RRlet they are not identical ). In addition there are classes for the saving, review and printout of views. The classes are in part: