Starting from:

$24

CSCI 201L Assignment #2

Introduction In this assignment you will create a text editing program. The program will be able to handle multiple files at once, which a user can tab between. The user may edit files, create new files, and save the files. The editor will be able to track the changes made, so a user may easily undo and redo their work. You will also integrate the spell-checking program from Assignment 1 so a user can correct their typos. Before you start Add the following code to the beginning of your main method. This will better your chances of your program looking the same on your machine as it does for a grader.
File Menu The program contains a single menu named “File”. It has four menu items: “New”, “Open”, “Save”, and “Close”. The “New”, “Open”, and “Save” menu items must have an appropriate accelerator.

New File A user can create a new file from the menu or by using its accelerator. When a new file is created, a tab is added to the window containing a blank text area.

Open File A user can open an existing file from the menu or by using its accelerator. When a user wants to open a file, the program will display a file chooser. The file chooser should be titled something like “Open File…”. The chooser should only allow for the selection of .txt files.

Save File A user can save an opened file from the menu or by using its accelerator. Regardless of whether the file was opened or was new, the file dialog box should be displayed. If the file already exists, the “File Name” field should be populated with the name of the existing file. If the file is new, the user will need to enter the name of the new file. The file chooser should be titled something like “Save As…”. The chooser should only allow for the user to select .txt files.

Close FileA user can close a file from the menu. Doing so will remove the tab from the window.[Note] You do not need to require a user to save the file before they close it.Edit MenuOnce you have a document open, there will be two additional menus. The first of these menus is the“Edit” menu. This menu will have six menu items: “Undo”, “Redo”, “Cut”, “Copy”, “Paste”, and “SelectAll”. The menu must contain separators where shown. Each menu item must have an appropriateaccelerator.[Note] The accelerators do not have to be cross-platform. Target them to your operating system.Undo and RedoUndoing and redoing functions can be quite complex to implement. Luckily, someone else has alreadydone the hard work. All the program has to do is integrate the functionality into its menu items. Themenu items are enabled or disabled depending on whether or not they can perform their action.[Note] Take a look at the UndoAction, RedoAction, and UndoManager classes as well as theUndoableEditListener interface.[Note] For an example of functionality, use undo and redo with a pre-existing text editor.Cut, Copy, and PasteThe cut, copy, and paste functions are quite simple. Cut removes selected text from the text pane, andputs it into the computer’s clipboard. Copy puts selected text from the text pane into the clipboard.Paste inserts the clipboard’s text into the text pane at the caret while removing any selected text.[Note] For an example of functionality, use cut, copy, and paste with a pre-existing text editor.Select AllSelect All is simple. The program simply selects all the text within the text pane.Assignment 1 IntegrationThe program from assignment one provides functionality for spellchecking. This is a very useful featurethat can be used in the program. Instead of copying and pasting the source code, add a jar file exportedfrom assignment 1 to the assignment 2 build path.Exporting the jar FileSelect your Assignment 1 project in Eclipse, and select File-Export… Select Java-Jar file. Select alocation to save the file, and press “Finish”.Using the jar File in Assignment 2Place the jar file into your assignment 2 project folder. In Eclipse, select the jar file, and select BuildPath-Add to Build Path. You will now be able to use the functionality of your first assignment.Spell Check menuThe functionality of assignment 1 will be used with a menu called “Spell Check”. This menu will have twomenu items: “Run”, and “Configure”.RunA user can run the spellchecker from the menu or by using its accelerator. By default, the program willuse wordlist.wl and qwerty-us.kb to run the spellcheck. The spellchecker will display the misspelledwords one at a time, starting from the beginning of the document regardless of the location of thecursor. The user will be able to ignore the misspelling (which will only ignore the word once, notperform the equivalent of an “Ignore All” function), add the misspelled word to the dictionary, orcorrect the word from the found suggestions. Once a word is dealt with, the next misspelled word isdisplayed. The window will close once all words have been dealt with or when the user exits manually.ConfigureA user can configure the .wl and .kb files used for spell checking. The configuration will display thecurrently used file next to an option to select a new file. When a user runs the spellcheck, the spellcheckwill use the files specified here

More products