top of page

Java FX/Event-Driven Programming

Objective: GUI Development with JavaFX

In this lab, you have to use JavaFX to develop a couple of GUI screens that can switch from one to the other, similar to what the system discussed in class did. The problem domain here is that of an old-style “Mom and Pop’s Clothing Store”, where people come in to buy one of four items: Shirts, Pants, Ties and/or Shoes. The main purpose of developing a system for this store owner is that it should enable them to generate an invoice for a customer purchase. Into the invoice, the amount the customer spent on buying any of the above four items should be entered (e.g., if the customer bought two shirts, and the shirts cost $ 12 each, then the clerk at the register should enter the value $ 24 into the appropriate place in the invoice (see the mockup of the invoice screen below)). So, the clerk will enter these costs for each of the items purchased into the appropriate spots in the invoice – she will enter $ 0.00 if the customer did not purchase any units of the item. For example, a customer could buy shirts and pants and no ties or shoes, so for the latter two spots, the clerk will enter “0.00”. Based on the values entered, when the clerk finally clicks the “Calculate” button at the bottom of the screen, then the Total value of the invoice will be computed and placed in the text field next to the “Total Bill” label. The cost of the invoice is based on the total cost of all items purchased, plus the sales tax added to it. The sales tax values are to be selected from the drop-down (“ComboBox”) shown in the mockup below. These sales tax values range from 3.00 to 9.50, in increments of 0.25, and each of the values in this range must be selectable from the drop-down.

The way you need to write your program is as follows:

  • You need to start by creating an “Invoice” class, on the lines of the “Loan” class discussed in class. This “Invoice” class will be the main Model object.

  • The first View that the “Invoice” class puts up on being created is a “LoginView” screen, that looks and operates on the same lines as the Login view discussed in class. It should have the title “Mom and Pop’s Clothing Store” though.

  • Once the user enters a user name and password on the login screen, an appropriate method in the “Invoice” class will be called. This method will look through a list of authorized users that the “Invoice” class maintains, and successfully log the current user (i.e., an authorized store clerk) in or not. The code for this functionality is already present in the code discussed in class.

Main Invoice Screen Mockup

  • Once the clerk is logged in, the Main Invoice Screen (as shown in the mockup above) should be displayed, and the behavior on this screen should be as described above.

  • When the user clicks the “Back” button on the Main Invoice Screen, the original Login Screen should be displayed again.

First, demonstrate that this code works to your instructor or lab assistant. Select a time during lab or another time to demo this. Make sure that your demo runs on one of the lab computers, so the instructor/lab assistant can maintain social distancing and see your code work.

Then, submit the code for all your classes. Capture (using Print Screen features) the Login and Main Invoice Screens your program creates. Be sure to capture the screens with the appropriate data filled in that shows the evaluator that your program is working. Submit these screen captures together with your code via email to the instructor. All the code AND the screen captures must be present in an MS Word file.

If you need any help related to JavaFx then you can contact us at below contact details to get professional GUI at and affordable prices:

62 views0 comments

Recent Posts

See All
bottom of page