CIS3931 Intro to JAVA Programming
Assignment #5 – The completed Simple Text Editor
Overview
For this assignment, you will be adding the text editor functionality to the shell you created in assignment #4.
Details
You will now be adding action listeners and creating the file reading and writing portions of the text editor. The following describes the expected behavior of each menu item.
File – New : Clear all text from the screen.
File – Open : Open a JFileChooser window and allow the user to select a file to open. Upon selection, the contents of the file should then be displayed to the JEditorPane window.
File – Save : Open a JFileChooser window and allow the user to either select an existing file to write over or choose a new filename to save to. Upon selection, the current contents of the JEditorPane should be written to the chosen filename. The user should then be permitted to continue editing the current JEditorPane window.
File – Quit : Close the GUI and cleanly exit the program.
Edit – Cut, copy, paste, and Select All : These menu items should perform the same as the native commands in Windows.
Font – Name : This menu item should have a submenu associated with it. The submenu should contain three JAVA fonts to choose from. When a font is selected, the entire JEditorPane will use the new font (and all existing text should be changed to the new font).
Font – Size : This menu item should have a submenu associated with it. The submenu should contain three font sizes (in standard point notation) to choose from. When a size is selected, the entire JEditorPane will use the new size (and all existing text should be changed to the new size).
Font – Style : This menu item should have a submenu associated with it. The submenu should contain three style choices : bold, italic, and underline. When a style is selected, the entire JEditorPane will use the new style (and all existing text should be changed to the new style).
Background Color and Text Color : Both of these menus should contain three colors choices (whichever you want) and should also allow the user to choose the JColorChooser to select a custom color. When a color is selected, the appropriate item (background or text) will change colors.
NOTE : All file I/O should have appropriate exception handling to prevent the user from crashing the program. Additionally, exceptions / errors should be reported to the user with dialog boxes.
Your text editor should close and exit the program when the “close” (“X”) button is pressed at the top right corner of the screen.
Your text editor should look like the following example :
Example of text editor with the “File” menu expanded (ignore the “alt-n” next to the word “New”) :
The example shows a window
called “Small Text Editor”. For your program, the window title should be your
last name followed by the works “editor skeleton”. For example, my title would
be “
Actual Program Output
Your program should look like the example pictures above.
Grading
5 points – Name, date, and assignment number on top of program
20 points – Proper commenting
15 Points – Programming style
60 Points – Program has all of the elements listed in the description
Total : 100 points
Extra Credit Opportunities
For an extra 35 points, add “filename association” and “Save As” functionality to your program. This means that the open button should now keep track of the filename that was opened so when the save button is pressed, it just automatically saves to the original name of the file. You would then have a SaveAs button to allow the user to save the file to a different name. Keep in mind that the New button should clear this filename association so that you don’t accidentally save a new document over an old document. When SaveAs is used, the filename association of the current document should be changed to whatever the new filename is. In other words, your Open, Save and SaveAs commands should behave exactly as the equivalent commands behave in Microsoft Word or Microsoft Notepad. This extra credit is ALL OR NOTHING. There will be no partial credit awarded. You will either get all 35 points (if it works correctly) or get no points (if it fails on any test).
For
an extra 15 points, create a button bar below the menubar.
The button bar should contain JButtons that perform
the open, save, and exit command. Each of these buttons should have a small
icon representing the action being performed (search google
for these… there are tons out there… or make your own). Additionally, there
should be a text label below each icon stating what the button does.
For an extra 10 points, create mnemonics for the new, open, save, and exit buttons. We did not discuss the creation of mnemonics in class, but the concept is rather simple. I suggest using google to figure out how to do this.
Grading explanation
Name, date, assignment number
Your program should have the following header format
/*
Name : {YOUR NAME HERE}
Date : {PROGRAM SUBMISSION DATE}
Assignment : {ASSIGNMENT NUMBER AND TITLE}
*/
Proper commenting
Your program should be properly commented. This means that a person who is unfamiliar with the JAVA programming language should be able to understand what each line/section of your code is doing by simply reading your comments. There is no such thing as too much commenting, so feel free to comment as much as you want.
Programming style
This is a catch “all” for many things. Your program should be indented correctly. The code should be easy for the grader to read. You should optimize your code so that you are meeting the objectives in as little lines of code as possible. You should attempt to use the most advanced programming technique possible to complete the objective. For example, use loops instead of manually repeated the same block of code. Your variable names should be clear and concise.
Program has all of the elements listed in the description
Please be sure to read the details section very carefully to be sure that you have all of the required elements.
Program due date and submission instructions
This program is due no later than Tuesday, 12th June, 05.
The program should be named Assignment5YOURFULLNAME.java
(Example : Assignment5RobertThornton.java)
You are to submit your source code (your .java file) to cis3931 at cs dot fsu dot edu
For
assignment clarifications, please e-mail
For help with your program, please e-mail cis3931 at cs dot fsu dot edu