|
Personal
About Me
Photo Gallery
Vegetarianism
Books
Computer Science
Linux/Unix
Home Computers
Programming
Web Development
Amateur Radio
What is it?
QSL Gallery
Morse Code
Restricted Areas
BA Ravensburg
|
Java
Due to project at the Constance University of Applied Sciences I got involved
in writing Java applets. The basic idea was to create an interface which allows
students to perform their laboratory exercises via the Internet right from
their bed at home.
Here are some small programs which give you some idea how Java applications and
applets are written.
1. Coefficient of correlation
The following command-line based application allows you to determine the
coefficient of correlation regarding two test series (x,y). After starting the
program, the values of each series are read into an array. Then the mean values
and the coefficient of correlation are calculated. Looking at this small
example you can see how easy runtime errors can be handled.
sta_a4.java (Java source
code)
2. Demo Applet
Concerning this program I basically want to show how to create an applet. It
has been written in order to hold a brief introduction about applet programming
at my university. The program consists of an input and an output line. When
you're entering a text into the input line, the same text will be displayed in
the output window immediately. Nothing special, so far. However, if you select
"Umgekehrt" at the selection box, the letters of your text will appear in
reverse order. Pressing the "Loeschen" button you can clear both text lines.
Furthermore, a parameter given from the html page allows you to change the
color of the border.
applet1.java (Java
source code)
applet1.zip (Click here to download
zipped archive (source, classes, html) 10kB)
3. SINPLOT While playing around with graphics and math functions, I got
the idea to create a tiny 3D plot. So I started writing a program which draws a
function twice at different locations connecting each calculated point between
the two curves. Though a real 3D plot would require distortion of the
functions, my plot already had kind of like three-dimensional impression. At
this point, I added some sliders to turn the picture horizontal (a) and
vertical (b). As I was interested how other functions would effect the picture,
two choices have been added which allow an independent selection of functions
for each curve. Using a third slider (c) you can change the resulotion of
calculations. Keep in mind, this program doesn't support real 3D distortion,
but playing with it is very nice, anyway.
SINPLOT (Click here to
start the applet (works best with any Browser !))
sinplot.java (Java
source code)
sinplot.zip (Click here to download
zipped archive (source, class, html) 5kB)
4. Gingerbread Man
The 'Gingerbread Man' is one of the most famous fractals. Actually, calculating
this picture is easier than you would expect. It is a recursive algorithm and
the color of a specific (x,y) tuple is determined by the number of iterations
that are necessary to reach a certain result. With the applet I've written you
will get a default view of the fractal. Clicking inside the picture will zoom
in (just have a try -- it's really fun and you can get very interesting
pictures!). To reset the applet, hit the reload button of your browser. I have
put detailed information into the source code on how the algorithm works.
FRACTAL (Click here to run
the applet (works best with Netscape 4.72 !))
fract.java (Java source
code)
fract.zip (Click here to download zipped
archive (source, class, html) 5kB)
|