Learning Objectives

The purpose of this lab is to give you an opportunity to learn two main topics: basic drawing and event handling using JavaFX.

Description

Create a JavaFX application that meets the following specification:

  • The program initially draws five circles (see Fig. 1).
  • When the user clicks on a circle, the selected circle should be highlighted (see Fig. 2). It remains highlighted until it is clicked a second time. It is possible to have several objects highlighted at the same time.
  • When the user drags a circle, the circle should follow the mouse movement and move to a new location where the user releases the mouse (see Fig. 3). The user should not be allowed to drag a circle outside the application window.

Fig. 1: When the program starts, it draws five circles. see image.

Fig. 2: When the user clicks on a circle, the circle should be highlighted. It will remain highlighted until it is clicked a second time or released from a drag operation see image.

Fig. 3: Dragging a circle to the corner. see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.