splitbrain.org

electronic brain surgery since 2001

Java Study Projects

These are smaller Java programs written by Frank Schubert and me during our computer science study. I decided to put them up again here because they were on my old site and some people still seem to look for them and they contain some useful basic examples.

The JAR files should run without compiling anything by running java -jar <file.jar>.

Looking for the FloatJSlider class? It's in the WaveJNI source code.

Game of Life

Xgofl ScreenshotThis is just another implementation of John Conway's Game of Life in Java. It comes in two versions: Gofl - A console version and Xgofl - A graphical version. Both versions make use of the same algorithm defined in universum.class.

JSheet

JSheet ScreenshotJSheet is a simple spreadsheet program. It supports strings and numbers in the cells and links between cells. Simple calculations are also done. The size of the Table is userdefinable and rows and columns can be added and deleted. Cell-Links are done in the form [x;y] where x and y are the coordinates of the referenced cell.

ComplexCalc

ComplexCalc ScreenshotComplexCalc allows you to enter two complex numbers (by textual input or graphical selection) and do an operation on them (Yes! RPN! cool huh?). The numbers are displayed as vectors in a 2D coordinate system.

Wave

Wave ScreenshotWave lets you change the properties of a wave and displays the result as graph. We created a shape implementing class named Wave2D which works similar to other shapes like Line2D or Rectangle2D.

WaveGradient

WaveGradient ScreenshotThis time three properties of a wave are represented: time (on the X-Axis), location (on the Y-axis) and amplitude (encoded in alphavalues). On the top and left border a projection of the drawn wave is painted. You can change the wave properties by moving the sliders on the right and rotate the drawn wave by dragging the mouse.

WaveThread

WaveThread ScreenshotAnother Java program about waves. This time there is no way to control the wave in any ways. All you see is a Wave going from left to right. But this time it's animated! Point of this exercise was it to learn how to use Threads and to performance tune a Java2D application. Well it moves but its still not very fast.

WaveJNI

WaveJNI Screenshot This program is able to display the result of up to five overlaying waves. Besides this, our task was to use the Java Native Interface JNI and to try different techniques in calculating the values to test their performance influences.

Description of the checkboxes:

  • Java
    • disabling this switches to the native calculation written in C
  • Pointer
    • This is only available in native mode. It enables the usage of pointers to walk the pixel array
  • use sin
    • This switches between the use of the sin() function and an approximation of the sine by using the Taylorpolynom. This should increase performance but in fact it does not due a stupid implementation by us :-)
  • use copy
    • This speeds thing really up. Instead of calculating every single pixel only the first row is computed and then copied to the other lines