CompSci 308
Spring 2024
Advanced Software Design and Implementation

Lab Coding Exercise: Learning OpenJFX and Making Classes

This exercise is intended for you to practice the basic GIT workflow commands (addcommit, and push), get used to OpenJFX, and create a Java class.

Submitting Your Work

There will not be an official submission for this exercise, instead show your progress to the Teaching Team during lab to get feedback.


Complete as many of the following tasks using your forked version of the lab_bounce project (they will all help prepare you for the Breakout project):

  1. Make the bouncer "bounce" off of the right "wall" by reversing its direction
  2. Make a second bouncer that starts in the same position as the first and moves to the left, at whatever speed you want, and bounces off the left "wall" by reversing its direction
  3. Make both bouncers bounce back and forth off of both walls
  4. Make a Bouncer class (or whatever name you prefer), with a constructor, as well as appropriate instance variables and methods (basically any code that refers to those instance variables);
    • then create two instances of that class as instance variables to replace the instance variables you moved to the new class and replace the code in the Example class that refers to those instance variables with calls to the new class's methods
  5. Make each bouncer start at a different place, with a different size, move in different directions (with both X and Y changes), and bouncing off of all the walls (including the corners)
    • change the Bouncer's constructor as needed or use randomness
  6. Make any number of bouncers, with different initial properties, that bounce around

For each task, you may make any changes to the code you think are warranted (functional, organizational, or creating new classes). After you think you have completed each task, make a GIT add and commit with an appropriate comment, so there should be at least 6 commits in your project history. After every two commits, push your changes up to Gitlab so your online repository reflects the work you have done today.


OpenJFX is a framework for creating Graphical User Interfaces (GUIs) that can run across a wide variety of platforms. As a modern framework, it replaces Java's (very old) Swing GUI framework and uses standard technologies that make it well-suited for creating visually-intensive applications, such as games, simulations, and data visualizations. While it contains many components for organizing and interacting with complex GUIs, for this lab and the first project, you only need to focus on the concepts in this example code: drawing, animating, and interacting with shapes and images (you will learn more with each successive project). Learning OpenJFX will help you learn any other modern GUI framework, for the web, mobile, or on the desktop.

Version control is a way to manage the many changes that occur to your files over time, but that simple idea changes everything! It allows you to revisit previous versions of your code, work with different versions at the same time, and work in teams and track who made which changes. At its best, version control is like a journal that you use to track major, and minor, events in your project. At its most practical, it is like a backup system that prevents you from losing significant work if something happens to your machine. At its worst, it is simply a submit system where you only track your work when told to. Knowing how to use a source control system will be an invaluable tool for you going forward, perhaps personally or even potentially for changes in laws, but especially in a team setting.

Using source control well is not difficult, but it does take some practice and a little bit of command-line savvy (we do not suggest using visual GIT tools, even the one built into IntelliJ, until you are confident in your version control skills).