Object Oriented Programming in Java

Module [M08] - JavaFX UI Controls

This is the last of our three modules dedicated to JavaFX. We are going to take a closer look at widgets; i.e. pre-defined GUI elements that you find in most user interfaces.

  • Textbook Reading Assignments
  • The following sections of the textbook are assigned for this module.
    • Chapter #16 – JavaFX UI Controls

Module Learning Outcomes

In this module, you will develop further your programming skills as follows;

Tracing
Ability to read and trace Java programs leveraging .
Implementing
Ability to write Java programs leveraging JavaFX UI Controls.
Testing
Ability to develop tests for Java programs leveraging JavaFX UI Controls.
Debugging
Ability to troubleshoot Java programs leveraging JavaFX UI Controls.
Designing
Ability to design Java programs leveraging JavaFX UI Controls.

As with the previous module, we are going to supplement the reading with some apprenticeship videos showing you how to apply the techniques you studied to exercises similar to the ones you will have to work on as part of your homework assignments.

  • A01 - CheckBoxes
  • File Link: YouTube
  • This exercise is #16.2 in the 10th edition of our text. Write a JavaFX program that draws different geometric figures based on what button is pushed. You will provide three radio buttons to draw respectively a circle, rectangle or ellipse. You will also provide a checkbox allowing to specify whether the geometric figure being drawn needs to be filled or not.
  • A02 - ShapesIntersect
  • File Link: YouTube
  • This exercise is practice exercise #16.08 in the latest edition of our text Write a program that enables the user to specify the location and size of two circles and displays whether they intersect. Enable the user to point the mouse inside a circle and drag it. As the circle is being dragged, the circle’s center coordinates in the text fields are updated.
  • A03 - Selecting Fonts
  • File Link: YouTube
  • This exercise is #16.14 in the 10th edition of our text. Write a program that can dynamically change the font of a text in a label displayed on a stack pane. The text can be displayed in bold and italic at the same time. You can select the font name or font size from combo boxes The available font names can be obtained using Font.getFamilies() The combo box for the font size is initialized with numbers from 1 to 100
  • A04 - ComboBox & ListView
  • File Link: YouTube
  • This exercise is #16.16 in the 10th edition of our text. Write a program that demonstrates selecting items in a list. The program uses a combo box to specify a selection mode. When you select items, they are displayed in a label below the list. Please note that the video stops right before we fix the issue with deselected items not updating the list in the label. The fix involves syntax that we have not covered yet, so I didn't include it but, if you are curious, post on the forums and I will attach the .jave file for you to peruse.
  • B01 - Buttons & Radio Buttons
  • This exercise is #16.1 in the 10th edition of our text. Write JavaFX program that displays a String in a pane. You will provide 5 radio buttons allowing to change the color of the message; blue, red, green, black, orange.
  • B02 - TrafficLight
  • This exercise is practice exercise #16.3 in the latest edition of our text Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on. Only one light can be on at a time. No light is on when the program starts.
  • B03 - Setclock
  • This exercise is practice exercise #16.7 in the latest edition of our text Write a program that displays a clock and sets the time with the input from three text fields. Use the ClockPane from Listing 14.19. Resize the clock to the center of the pane.
  • B04 - LabelDemo
  • This exercise is practice exercise #16.15 in the latest edition of our text Write a program to let the user dynamically set the properties contentDisplay & graphicTextGap.