Paint and Guest Book Program
Overview
A paint program is available for use. This program can be used in a number of different
situations some of which are:
- As a guest book where entries are personalized. Each entry consists of a picture
generated by a visitor using a paint program. Thus allowing the visitor to be more creative
than with 'text only' guest books.
- As a competition where visitors are encouraged to submit pictures for review and where
winners are selected and published at regular intervals.
- As a graffiti board.
- As an example of a complete Java source program which uses many features of the
java.awt and java.net packages.
The program consists of a Java applet (11 class files) and two supporting Perl scripts.
User Guide
A help file is included with the program. This file describes in detail the capabilities of the program and how to use it.
Options
The java applet is called from an html file (see Paint.html) using the following code:
<applet code="Paint.class" width=600 height=400>
<param name=Server value="linuxenvy.com">
<param name=UserName value="bprentice">
<param name=Directory value="Paint">
<param name=ReadFile value="picture">
<param name=WriteFile value="picture">
<param name=Mail value="bprentice@webenet.net">
<param name=Message value="A new picture has arrived.">
</applet>
The seven 'param' lines define the applet options. The value of 'Server' is the address
of your server. The value of 'UserName' should be set to your user name. If you install the program in a subdirectory of your public_html directory, set the value of 'Directory' to that subdirectory otherwise set the value of 'Directory' to "".
The program saves picture entries in a picture file. This file contains a special
header and a special marker picture containing the text 'Start'. For security reasons,
the program will not create this file and will only append pictures to an existing
file containing this special header. The file is normally called picture and is
created by making a copy of the file called header.
The values of 'ReadFile' and 'WriteFile' should normally be set to the same value picture.
If you wish to edit a picture file, however, set the value of 'ReadFile' to an existing
file and set the value of 'WriteFile' to the name of a new copy of the header file.
If you wish to be informed by mail when a new picture entry arrives set the value of
'Mail' to your email address and the value of 'Message' to the message that you want mailed.
Otherwise set both of these values to "".
Implementation
To implement the program do the following:
-
Download Paint.zip and unzip it using
WinZip. This will provide you
with copies of all the files.
- Decide whether to use the program as a guest book, as an art competition
or for some other purpose.
- Decide on a directory to hold your program. This will typically be your
public_html directory or one of its subdirectories.
- Edit the Paint.html file to reflect your needs paying particular attention to the
six 'param' lines which define your options.
- Upload all the 'class' files, all the 'gif' files, Paint.html, PaintHelp.html and
header to your selected directory.
- Make a copy of header and call it picture (or the value of the WriteFile parameter if
you changed this parameter).
- Test your program.
Server Installation
The Perl scripts ReadPicture and WritePicture and the Paint.html file must be changed.
Line 11 of ReadPicture and line 11 of WritePicture contain the path to the server's user
directory and should be changed to your user directory path. These two files should then be
placed in your cgi-bin directory. The value of the Server parameter of the applet call in
the file Paint.html should be changed to your server address.
Files
The following files are included in Paint.zip.
- Buttons1.gif
- Buttons2.gif
- ColorSelector.class
- CustomColor.class
- Document.html
- Font.gif
- Fonts.class
- Format.html
- GraphicsExtension.class
- IntField.class
- Paint.class
- Paint.html
- Paint.java
- PaintHelp.html
- Palette.class
- Palette.gif
- Picture.class
- ReadPicture
- ScribblePad.class
- Tool.gif
- ToolConstants.class
- Tools.class
- WritePicture
- header
Example
You may examine and try a
working example.
Source Code
The Java source code for Paint is
here,
the Perl source code for the ReadPicture script is
here
and the Perl source code for the WritePicture script is
here.
The format of the picture file is described
here.
Other Programs
Please take a look at my
Patterns Program.
Contact
This program was written by Brian Prentice who may be contacted at
bprentice@webenet.net.
If you use this program please send a postcard of your home town to the following
address and if possible use an interesting stamp.
Brian Prentice,
355, So 8th St., #1
Coos Bay OR 97420
USA