Objective: The goal of this lab is to practice creating graphical user interfaces with JavaFX.

A) Write a program that paints a smiley face. Amount of detail and shapes and color choices are up to you, but at the very least your face must have four identifiable features (e.g., two eyes, a nose, and a mouth) and an encompassing face (outline, of some sort). Feel free to be creative! (If confused, perhaps think how you'd design a jack-o-lantern face ;)

B) Write a program that enables the user to specify the location and size of two rectangles, draw the rectangles, and display whether the two rectangles intersect. I've written starter code for you for this problem (particularly to give you some of the layout), but feel free to start from scratch if youd like to figure it out yourself. (If you use the starter code, look for TODOs in comments.)

Once finished, running your application should look roughly like this: see image.

After entering in some rectangle info: see image.

Hints:

a) To center an element, like say, a button, you can add it to a StackPane, then add that StackPane to the desired layout/location. For example,

otherPane.getChildren().add(new StackPane(new Label("Centered text")));

b) To parse a double value from a String, you can use Double.valueOf("double string");

c) To determine if two rectangles intersect, consider that it may be easier to determine if they don't intersect (then if they dont not intersect, they intersect ;).

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.