Due by the end of Tuesday, 2 February 2021
When this week's lab is done, you should have a GUI that looks and behaves like this:
Change the name of the Calculate button to Add. Add a Multiply button beside the Add button. When pressed, it multiplies the two numbers together and saves the result in the result box.
The multiplier works just like the adder, except that it does multiplication rather than addition.You should also change the instruction label so it asks for two numbers "to add or multiply" and the title of the window to "Add/Multiply Dialog".
There are three kinds of objects required:
When you create an item or a menu, you give the name as an argument to the constructor -- new JMenuItem("Add"), for example. The JMenuBar constructor needs no argument.
When you have created all the objects you need, you should add the JMenuItems to the JMenu, and the JMenu to the JMenuBar.
Then you need to use the JFrame's setJMenuBar method to add the menubar to the adder dialog window. (Note: it is not added like the other controls.)
JMenuItems are very much like JButtons: you need to add an action listener to them to get them to do anything.
Make sure all your buttons and menu commands work.
Submit this/these files:
You will be graded on the following: