Lab 12: Simple GUIs
You need to write a standalone application that has the following interface:

The functionality is defined here:

Stage One. A college bookstore receives cartons of textbooks. In each shipment, each carton contains the same number of textbooks. The inventory manager wants to use a computer to calculate the total number of textbooks arriving at the bookstore for each shipment. The inventory manager will enter the number of cartons received and the fixed number of textbooks in each carton of the shipment; the application should then calculate and display the total number of textbooks in the shipment.

Once this part is working we move on to the second set of requirements:

Stage Two. The inventory manager notices a flaw in your Inventory application. Although the application calculates the correct result, that result continues to display even after new data is entered. The only time the output changes is when the Inventory manager clicks the Calculate JButton again. You should alter the Inventory application to clear the result as soon as the user enters new information into either of the JTextFields, to avoid any confusion over the accuracy of your calculated result.

Here are prototypes for the two stages (and for the third program all shown in lecture):

  • Take this: labTwo01.jar (Right-click and download on the desktop).
    After download run with this: java -classpath labTwo01.jar Inventory

  • Take this: labTwo02.jar
    After download run with this: java -classpath labTwo02.jar Inventory

  • Take this: labTwelve.jar
    After download run with this: java -classpath labTwelve.jar TypingApplication
    It's hard to make justice to the way this looks when you run it but it's a bit like this.

Write your application and submit/comit it to your repo.


Updated by © Adrian German for C212/A592 -- 6W1 Summer 2019