CIS 120 GUI Lab

Overview

Given the success of all-day breakfast shops (donuts, bagels, cereal) you and your friends would like to open the latest incarnation: All day eggs!

As part of your plan you would like to have a simple way to calculate the prices---a basic breakfast order consists of two eggs, any number of toppings and one beverage. Customers should be able to specify how their eggs should be cooked, what sort of condiments they would like for their eggs, and what they want to drink (if anything). Your application should calculate the price of this order, taking into account the local sales tax rate.

GUI

[windows version][linux version]

The price for a particular order should be determined by the following price list:

Price List
Sunnyside up
2.00
Scrambled
2.00
Over easy
1.50
Poached
2.00


Ketchup
0.20
Salt
0.10
Pepper
0.10
Cheese
1.00
Salsa
1.00


Coffee
2.00
Milk
1.50
Orange Juice
3.00


Tax rate
6%

Assignment

Your job is to write this application, contained in the class EggShop (which extends the class javax.swing.JFrame), whose single, no-argument constructor opens the 400 x 250 pixel frame shown above. The main method in this class should just use this constructor to create an instance of this class. Your window should look exactly like the one above, modulo any OS-based differences. The total price displayed at the bottom of the window should always be correct (and include sales tax) even as customers change their minds about their orders. When the window is closed, the application should terminate.

Skeleton Files

And the javadocs.

Getting started

Challenge

Modify the OptionPanel class to enable mouse position tracking. Whenever a mouse is clicked, print out out the mouse's x and y positions. Hint: use a MouseListener.