The JAVA Book Applet
Have you seen my digital/analogWorldTimeClock applet?




Can I have the source code?

Sure. Here it is: book.java.
Take it, use it, change it, do whatever you want with it.

Can I have this on my web page?

Sure. Follow the steps:

1. Upload this file to your web directory: book.class.

2. Add the following code to your web page:

<APPLET CODE="book.class" CODEBASE="my directory" WIDTH=480 HEIGHT=320>
</APPLET>
.

Replace my directory by the directory, where you have the file of step 1 or remove the whole CODEBASE="my directory" if it's in the same directory as your web page. Later you will have to adjust the width and the height of the applet depending on your settings.

3. Add a new line before the </APPLET> tag and enter the following code:

<PARAM NAME=name VALUE="value"> .

Now replace name by the name of the parameter you want to change and value by the value you want to change it to from the table below.

4. Repeat step 3 for all the parameters you want to change. Note that every parameter has a default value, so you only have to give the ones you want to change. Some parameter values consist of more than one argument, separated by comma. Everything before the first comma, between the commas and after the last comma is treated as an argument, so don't type spaces after the commas.
And here are all the possible parameters:

parameterfunctionpossible valuesdefault value
pgnumber the number of pages in the book a positive integer larger than 0 20
startpg the page which is open when the applet is loaded a positive integer smaller than pgnumber and larger than 0 2
pgwidth the total width of one page a positive integer larger than 0 (in points) 200
pgheight the height of one page a positive integer larger than 0 (in points) 300
bdwidth the width of the border of one page a positive integer (in points) 2
bgcolor the color of the background a list of three integers between 0 and 255, determining the contributions of red, green and blue 255,255,255 (this gives white)
bdcolor the color of the border the same as bgcolor 0,0,0 (this gives black)
pgcolor the color of the pages the same as bgcolor 255,255,255
head the headline which appears above the book before the first user action a string Use arrow keys, enter page number or click page numbers.
f[i] type, face and size of the font[i], where [i] has to be replaced by a single digit, i.e. you can define up to 10 fonts a list type,face,size, where type can be any font the browser can handle, face can be plain, bold or italic and size an integer (in points) TimesRoman,plain,12
c[i] the color[i], where [i] has to be replaced by a single digit, i.e. you can define up to 10 fonts the same as bgcolor 0,0,0
img[i] the picture for page [i], where [i] has to be replaced by an integer between 1 and pgnumber name of any image file the browser can handle  
text[i] the text for page [i], where [i] has to be replaced by an integer between 1 and pgnumber any string with the tags described below  


The pictures are automatically scaled to fit the page.
In the text you can include tags <f[i]> and <f[i]c[j]> where [i] and [j] are single digits and f[i] and c[j] correspond to the fonts and colors you have defined. After each tag a new paragraph begins, which is then formatted.
f0 and c0 are used as well for the headline.
Here is an example for the complete code you have to add to your web page:

<APPLET CODE="book.class" WIDTH=480 HEIGHT=320>
<PARAM NAME=pgnumber VALUE="8">
<PARAM NAME=pgcolor VALUE="255,255,208">
<PARAM NAME=bgcolor VALUE="255,255,255">
<PARAM NAME=bdcolor VALUE="0,0,0">
<PARAM NAME=pgwidth VALUE=180>
<PARAM NAME=pgheight VALUE=250>
<PARAM NAME=img2 VALUE="photo1.jpg">
<PARAM NAME=img3 VALUE="photo2.jpg">
<PARAM NAME=img4 VALUE="photo3.jpg">
<PARAM NAME=c0 VALUE="0,0,0">
<PARAM NAME=c1 VALUE="255,0,0">
<PARAM NAME=c3 VALUE="255,255,255">
<PARAM NAME=f0 VALUE="TimesRoman,bold,12">
<PARAM NAME=f1 VALUE="TimesRoman,plain,12">
<PARAM NAME=text1 VALUE="<f0c1>Welcome to<f0>The JAVA Book Applet!<f1> <f1c0>This is a JAVA applet which looks like a book. You can put text and pictures on each page and the user can page through the book by clicking the page numbers, using the arrow keys and entering a page number.<f1>Press the right-arrow-key or click the 2 at the bottom.">
<PARAM NAME=text3 VALUE="<f0> <f0> <f0> <f0> <f0> <f0> <f0> <f0> <f0> <f0> <f0> <f0> <f0c3>On these pages you can see how text and pictures can be combined.">
<PARAM NAME=text4 VALUE="<f1> <f1> <f1> <f1> <f1> <f1> <f1> <f1>Furthermore you can adjust a lot of parameters, like page number, sizes, colors and fonts.">
</APPLET>

This gives the applet you see on the top of this page.

5. Adjust width and height of the applet so that they fit your settings.

6. Play around with the parameters and create the book you like!

It doesn't work!

Check if all the parameters are correctly given. Still not working? Send me an email to [email protected].

It works!

Please put somewhere on your page a link to this page to let others know where you have the applet from.
If you have any comments, questions or ideas, feel free to send me an email to [email protected].

visitors total:
GOWEBCounter by INLINE
visitors at the moment:

Hosted by www.Geocities.ws

1