Create a GUI-based program to help me manage my glass collection for my business. The program will create an object for each type of glass, allow the user to enter/view data on each type of glass through a GUI, and save the objects in a list (implement as array or ArrayList, your choice).
Glass Class Definition
The Glass class must contain the following fields:
- Code — String value, used as the primary key, with two letters corresponding to the manufacturer followed by up to four digits indicating the color
- Manufacturer — String value
- Color code as an RGB value (integer or Color object)
- Color name — String value
- Quantity in ounces — integer value
- Type of glass — rod, frit, or tubing, suggest integer value or enum
- Characteristics — array of boolean values for WYSIWIG, reactive, striking, chrome
- Notes — string
Each field will need an accessor method and a modifier method. You may choose to implement one or more constructors, but no other methods will be necessary.
Each field of the glass class will have a widget for data entry in the GUI, as follows:
- Code: one or more text fields, code letters should be automatically assigned based on Manufacturer selection
- Manufacturer: combo box with optional drop-down, values are Northstar (code NS), Glass Alchemy (code GA), Trautmann (code TAG), and Momka (code MK)
- Color code: color chooser
- Color name: text field
- Quantity: two text fields, one for pounds and one for ounces (display quantity as lbs./oz. but store as oz. only)
- Type of glass: radio buttons for rod, frit, tubing, with rod as the default selection
- Characteristics: check boxes, with all unselected as the default
- Notes: text area
- Navigation buttons: buttons for First (displays first entry), Next (goes to next entry), Last (goes to last entry in current list), Exit (exits program). If First or Next land on an element that doesn’t yet exist, display an empty GUI for the user to fill in.
Each widget should have an associated Listener object of the appropriate Listener type (see the API for what to use for each). Each Listener should update the corresponding value(s) when the attached widget is modified; in other words, the objects are updated on-the-fly rather than via an Update button.
- Make your Exit button save the glass objects in a file. You will have to make the Glass class implement the Serializable interface. The Action Listener for the Exit button will create a file of class OutputObjectStream, and write each object from the array to the file using the writeObject method.
- Allow the user to enter the name of a file containing Glass objects, create an InputObjectStream object from that file name, and read in the objects from the file and store in the array using the readObject method.