Description
In this stage, you will improve your text editor.
Also, in this stage, you should implement a menu bar. It is the GUI element that sits in the top left corner of the screen and pops up with different options when you click on it. This should be implemented using JMenuBar, whose menu lists are implemented using JMenu and whose menu items are implemented using JMenuItem. You should add an ActionListener to every JMenuItem in the menu bar. The menu bar should contain three options: Load, Save and Exit, which duplicate the buttons Load, Save, and the "Exit" option which should shut down the application. To safely close the window, you should call a method dispose() on the JFrame. You may look at this tutorial to create a menu bar.
Due to testing reasons, you need to set name to some components.
Set the names to these components:
- JTextArea component to "TextArea"
- Field which contains filename to "FilenameField"
- Button that saves the file to "SaveButton"
- Button that loads a file to "LoadButton"
- ScrollPane to "ScrollPane"
- JMenu "File" to "MenuFile"
- JMenuItem "Load" option in menu to "MenuLoad"
- JMenuItem "Save" option in menu to "MenuSave"
- JMenuItem "Exit" option in menu to "MenuExit"
Example
Below is the example of how your text editor might look.