[Life3D Pic] Chapter 3.   Get a Life (the Java 6 Way)

 

The Life3D example is utilized again in this chapter, this time as a way to discuss four new Java 6 features useful for gaming:

[Splash Pic]

This chapter's Life3D still displays a rotating 3D grid of cells which obey rules inspired by Conway's Game of Life. The graphics code is mostly unchanged, so I won't need to explain it again.

The two most significant things that I've removed from the application are the configuration window (and its properties configuration file), and full-screen rendering. The application starts with hardwired values for its window size, background color, grid rotation speed, and birth and die ranges.

The most visible new elements are a splashscreen which includes an animated clock picture (see the picture on the right), and a popup menu accessible from a system tray icon (see below on the right).

[Tray Pic]

The popup menu allows the user to modify Life3D in various ways at runtime. This includes the grid's rotation speed and the scene's background color. The application can also be iconified/deiconfied, and closed. The menu utilizes Java's new desktop API to let the user access the system's default web browser, a text editor, and e-mail client.

One of the exciting elements of Java 6 is its ability to communicate with scripting languages. In Life3D, JavaScript if-then rules to control how cells change over time, and the user can edit them at runtime to dynamically change the grid's behavior.

 

Downloads


Navigation:


Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page