Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. [45 points] Graphical User Interface . Build the following GUI. FIGURE 1 . Main window implemented in class MenuManagerGUI FIGURE 2 . Secondary window

5. [45 points] Graphical User Interface. Build the following GUI.

FIGURE 1. Main window implemented in class MenuManagerGUI

image text in transcribed

FIGURE 2. Secondary window for displaying the details of a Menu, also implemented in MenuManagerGUI class

image text in transcribed

Create the class MenuManagerGUIcontaining all graphic components and a MenuManager object. Also contains a main(String[] args) method.

Declare ALL components (all JLabel, JFrame, JButton, JComboBox, JTextField, etc) as fieldsin MenuManagerGUI.

Make sure you declare a MenuManager object as a field of the MenuManagerGUI class.

The constructor of the class MenuManagerGUIshould:

Create the MenuManager object, which loads the data from the file.

Initialize and place all graphic components

Load the ArrayLists of MenuManager object into the comboboxes. In other words, fill the comboboxes in the main window with the ArrayList of appetizers, entrees, sides and beers that are contained in the class MenuManager.

The execution of the MenuManagerGUI.main method does the following:

Creates a MenuManagerGUI object calling the constructor explained before

Set the JFrame visible, so the main window appears

The main window in the GUI gives you four options to generate Menu objects. These four options correspond to the buttons:

"Create Menu with these dishes" button take the selected elements in the four comboboxes and creates a menu. Just before creating the menu object, it asks the user to input a name for the menu. The newly created menu is added to the list at the side.

"Generate a Random Menu": this button asks the user to input a name for the new menu and then uses the method randomMenu in class MenuManager. The random menu generated is then added to the list in the right side.

[Optional: extra credit] "Generate a Minimum Calories Menu": similarly than the previous button but now using the method minCaloriesMenu() from MenuManager.

[Optional: extra credit] "Generate a Maximum Calories Menu": similarly than the previous button but now using the method maxCaloriesMenu() from MenuManager.

The list of the right side is where generated menus are placed. The list shows the menus by their names. For achieving this, make sure you override the method toString in class Menu.

The button Details (FIGURE 2) displays the secondary window filling all the fields contained there (all textfields and textareas) with the information of the selected Menu in the list of generated menus in the main window (right side in FIGURE 1). Note that the name of the menu selected is in the title of the Details window (FIGURE 2). If no menu is selected in the list, then the secondary window is not shown.

The button "Delete all" removes all Menu elements from the list.

The button "Save to File" writes a file "data/menus.txt" with the whole data of the menus in the list. Use the method writeMenusfrom the FileManager class.

All text fields in the secondary window (FIGURE 2) are "read only". This mean their values are filled by the program but the user cannot change them.

Menu Manager -Build your own Menu Created Menus: Entree Sirloin Steak Side Salad Mixed Vegetable Dessert None Menu for Monday My own Menu Menu for Tuesday Wednesday's lunch Vegan Menu Create Menu with these dishes Or generate a Menu Generate a Random Menu Generate a Minimum Calories Menu Generate a Maximum Calories Menu Delete a Save to file Menu Manager -Build your own Menu Created Menus: Entree Sirloin Steak Side Salad Mixed Vegetable Dessert None Menu for Monday My own Menu Menu for Tuesday Wednesday's lunch Vegan Menu Create Menu with these dishes Or generate a Menu Generate a Random Menu Generate a Minimum Calories Menu Generate a Maximum Calories Menu Delete a Save to file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago