Create a word processing program that can: Spellcheck *** This is the one that I
ID: 3658355 • Letter: C
Question
Create a word processing program that can:
Spellcheck *** This is the one that I am having the most trouble working on.
Find and Replace words
Select Font type and Font size
Open a text file and edit it
Save a file
Copy and paste <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
Undo and Redo
// This is where I am at now......... Thanks.
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.TransferHandler;
import javax.swing.text.DefaultEditorKit;
import javax.swing.undo.UndoManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Hashtable;
public class WordProject
{
//Creating a menubar and menus to go on the menubar
public static JMenuBar menubar = new JMenuBar();
//Creating a menubar and menus to go on the menubar
public static JMenu file = new JMenu("File");
//Creating a menubar and menus to go on the menubar
public static JMenu edit = new JMenu("Edit");
//Creating a menubar and menus to go on the menubar
public static JMenu format = new JMenu("Format");
//Creating a menubar and menus to go on the menubar
public static JMenu help = new JMenu("Help");
//Creating a menubar and menus to go on the menubar
public static JTextArea textArea = new JTextArea();
//Creating the menu items for each menu
public static JMenuItem exit = new JMenuItem("Exit");
//Creating the menu items for each menu
public static JMenuItem save = new JMenuItem("Save");
//Creating the menu items for each menu
public static JMenuItem open = new JMenuItem("Open");
//Creating the menu items for each menu
public static JMenuItem undo = new JMenuItem("Undo");
//Creating the menu items for each menu
public static JMenuItem redo = new JMenuItem("Redo");
//Creating the menu items for each menu
public static JMenuItem fontType = new JMenuItem("Font Type");
//Creating the menu items for each menu
public static JMenuItem fontSize = new JMenuItem("Font Size");
//Creating the menu items for each menu
/*public static JMenuItem copy = new JMenuItem("Copy");
//Creating the menu items for each menu
public static JMenuItem cut = new JMenuItem("Cut");
//Creating the menu items for each menu
public static JMenuItem paste = new JMenuItem("Paste");
*/
//Creating the menu items for each menu
public static JMenuItem spellCheck = new JMenuItem("Spell Check");
//Creating the menu items for each menu
public static JMenuItem find = new JMenuItem("Find");
//Creating the menu items for each menu
public static JMenuItem about = new JMenuItem("About");
public static void main(String[] args)
{
//Creating a frame for the NotePad
JFrame frame = new JFrame ("Microsoft Word");
frame.setSize(600,500);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Creating a text area for users to type in
textArea.setSize(500, 400);
textArea.setVisible(true);
frame.add(textArea);
//Adding a menu bar to the frame
frame.setJMenuBar(menubar);
//Adding a file option to the menubar
menubar.add(file);
//Adding an open option underneath file tab
file.add(open);
//Adding an save option underneath file tab
file.add(save);
//Adding an exit option underneath file tab
file.add(exit);
//Adding a edit option to the menubar
menubar.add(edit);
//Adding a redo option underneath edit tab
edit.add(redo);
//Adding a undo option underneath edit tab
edit.add(undo);
//Adding format option to the menubar
menubar.add(format);
//Adding a font type option underneath format tab
format.add(fontType);
//Adding a font size option underneath format tab
format.add(fontSize);
//Adding a spell check option underneath format tab
format.add(spellCheck);
//Adding a find option underneath format tab
format.add(find);
//Adding a help option to the menubar
menubar.add(help);
//Adding a about option underneath help tab
help.add(about);
//Adding the cut function
Action cutAction = new DefaultEditorKit.CutAction();
cutAction.putValue(Action.NAME, "Cut");
edit.add(cutAction);
//Adding the copy function
Action copyAction = new DefaultEditorKit.CopyAction();
copyAction.putValue(Action.NAME, "Copy");
edit.add(copyAction);
//Adding the paste function
Action pasteAction = new DefaultEditorKit.PasteAction();
pasteAction.putValue(Action.NAME, "Paste");
edit.add(pasteAction);
class helpAction implements ActionListener
{
public void actionPerformed (ActionEvent e)
{
//Creating a new window when the about option is clicked
JFrame frame2 = new JFrame ("About");
frame2.setSize(250, 250);
frame2.setVisible(true);
//frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Creates a field that will display information about who made this program
JTextField field = new JTextField();
field.setEditable(false);
frame2.add(field);
}
}
about.addActionListener(new helpAction());
class undoAction implements ActionListener
{
public void actionPerformed (ActionEvent e)
{
//manager.undo();
}
}
undo.addActionListener(new undoAction());
//ActionListner for the exit option so the program closes when exit is clicked
class exitAction implements ActionListener
{
public void actionPerformed (ActionEvent e)
{
System.exit(0);
}
}
exit.addActionListener(new exitAction());
}
}
Explanation / Answer
ctrl +F ctrl +R ctrl +C ctrl +V ctrl +X ctrl +Y
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.