Java Applets in Physics

(Table of the Nuclides)


Rossen Angelouv Radev
GSI Student Program

Tutor: Peter Malzacher

1. Introduction

Java is a new programming language for networking computers which was developed between 1990 and 1995. In this language programs can be written which are available via Internet, can be downloaded and executed on the users machine. To perform this the program code must run machine-independently since there are a lot of types of computers involved in the Internet. Java is: A simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, and dynamic language. There are two kinds of Java-programs: applets and applications.
Applets are programs which run embedded in a WWW-side. To run them one needs a Java-capable Web-browser.
Applications are independent -stand alone- runnable programs just as programs written in other computer languages. To run them a byte-code interpreter (java) is needed.
Java is an interpreted language, so it is never going to be as fast as a compiled language. (E.g. Java is about 20 times slower as C.) Therefore it is unsuitable to be used for scientific computation. But this speed is quite adequate to run interactive, Graphical User Interface (GUI) and network-based applications, where the application is often idle, waiting for the user to do something, or waiting for date from the network.

My work at Student Program  was to learn the syntax of Java and try to make a interactive Applet -"Table of the Nuclides". To performe this, I used the examples found in the Java Tutorial of Sun [3b] and in the books [1a], [2a], [1b], [2b] and [4b]. There are lot of  examples available on the Internet [1c], [3c], [4c], [5c].

2. Steps to a Java Applet

By writing an applet the Java source code is to create at first. It is a simple text file with the extension ".java".
From the source code the Java compiler creates the Java byte code with the extension ".class" which can be run by the interpreter.
The third step is to create an HTML-source code with the "<APPLET>"- tag, with the extension ".html":
<APPLET CODE="PaintTable.class" WIDTH=1000 HEIGHT=600>
<PARAM NAME="database" VALUE="">

3. Applet "PaintTable"

During my Java-studies I develop an applet modeling  the interactive "Table of the Nuclides" [2c].
To paint the Nuclides I use the data file extracted from "Evaluated Nuclear Structure Data File" [3a], [4a].
To performe this I create Unix Shell scripts, that extract information from different data files and make one big file (catalog.log) containing all necessary data.
Applet PaintTable read data from catalog.log file, calculate the position, and paint nuclides on the screen.
There a three functions available:
    a) Zoom In: Table is "click able", and if user click in the table, applet show more information from selected region.
    b) Zoom Up: This is reverse of the Zoom In function.
    c) Reset: This function reset Table to start position.
Applet paint nuclide name, atomic number A, and color (not available yet).
When mouse is positioned to table, applet show in the bottom status line of Netscape screen the number of neutrons N, protons Z, and the atomic number A of current nuclide [fig. 1].

4. - Program Structure

Class Status Description
Element public A helper class. Define data for one Nuclide.
PaintTable public Main class. Define Data Types and Paint Methods. 
Method Description
init() Initialize the table, open Input Stream, read data from file.
paint() Paint all table elements and labels.
update() Update image.
mouseUp(), mouseDoun(), mouseMove(), action() Mouse action events.
paintElement(), paintLabel() Paint nuclide and table label.

5. Summary

The development of the PaintTable Applet and Shell scripts has been finished, bat in future development it is possible to create applet, that make Graphical User Interface (GUI) to all data contained in "Evaluated Nuclear Structure Data File".
Now Apllet PaintTable is available in my page in GSI-Web Server :
          [1a] David Flanagan, Java in a Nutshell, O'Reilly & Associates Inc. (1996).
          [2a] Timothy Budd, An introduction to Object-Oriented Programing,
                  Addison Wesley Inc (1997) .
          [3a] Richard B. Firestone, Table of Isotopes, Wiley Interscience (1996).
          [4a] J.K.Tuli, Evaluated Nuclear Structure Data File, National Nuclear Data Center (1987).
  Internet References
        Online Books:
          [1b] Special Edition Using Java, 2nd Edition - Online Version,
                  Macmillan Publishing USA (1997).
          [2b] David Flanagan, Java in a Nutshell,1st Edition - Online Version,
                  O'Reilly & Associates Publishing (1996).
          [3b] Mary Campione, Kathy Walrath, The Java Tutorial - Object Oriented programming for the Internet,
                  Online Version (1997)
          [4b] Java Development Kit 1.1.4 Documentation, Sun Microsystems (1997) .
          [1c] Table of the Nuclides.
          [2c] Rossen Radev, Chart of the Nuclides.
          [3c] TIPTOP: Online Physics Java Applets and VRML Resources .
          [4c] Jochen Frohlich, Neural networks with Java (1997).
          [5c] Top 1% Java Resources.