Tino APCS

JavaFX Lab 5.1 LifeGUI 2.0

In this lab we will improve JavaFX Lab 4.2 LifeGUI 1.0 by adding extra features and animation.

Basic Requirements for Life GUI 2.0

  • Everything from Life GUI 1.0
  • Add a ToggleButton such that
    • When depressed, Life animates automatically from generation to generation
    • When not depressed, animation is stopped
  • Instead of writing separate EventHandler classes, try using at least one anonymous inner class and/or a Lambda Expression.
  • Add a slider that controls the speed of the animation using an AnimationTimer.
    • Your slider values can be in terms of milliseconds delay between animation frames or in frames per second (which you would then internally translate into milliseconds)

Optional Challenges

  • Add a reverse toggle button such that
    • When pressing the Next Generation button, the board returns to its previous state.
    • When pressing the Play button, the board reverses animation until it reaches generation 0 at which point animation stops.
  • Add a way to change the number of rows and columns in the GridView
  • Instead of a zoom slider, allow the user to zoom in/out with the mouse wheel.
    • Wrap the GridView in a ScrollPane so that when zooming, if the size of the GridView is larger than will fit in the Scene then the user can scroll around.
    • When zooming, instead of zooming based on (0, 0), which is the default behavior of a ScrollPane, zoom centered on the mouse coordinates.
  • Add transitions to the Rectangle objects so that when cells die or come to life they animate. For example, when a cell dies you could make the Rectangle explode by increasing its size and fading out.
  • Anything fun that you can think of

You must Sign In to submit to this assignment

Last modified: March 08, 2023

Back to Animationtimer

Dark Mode

Outline