0% found this document useful (0 votes)
77 views39 pages

Notepad Project: Under The Guidance Of: By: Mr. Krishna Kumar Singh Amit Pathak (0715010021)

This document summarizes a Notepad project completed by students Amit Pathak and Amit Singh. It includes certificates of project completion signed by an external examiner and their project guide. It also includes an acknowledgements section thanking those who supported the project. The introduction provides an overview of the Notepad application, which is a text editor that checks for spelling and grammar errors in English text.

Uploaded by

Avneeshwar Singh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views39 pages

Notepad Project: Under The Guidance Of: By: Mr. Krishna Kumar Singh Amit Pathak (0715010021)

This document summarizes a Notepad project completed by students Amit Pathak and Amit Singh. It includes certificates of project completion signed by an external examiner and their project guide. It also includes an acknowledgements section thanking those who supported the project. The introduction provides an overview of the Notepad application, which is a text editor that checks for spelling and grammar errors in English text.

Uploaded by

Avneeshwar Singh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 39

NOTEPAD PROJECT

UNDER THE GUIDANCE OF: Mr. Krishna Kumar Singh

By: Amit Pathak (0715010021)

CERTIFICATE OF PROJECT COMPLETION

This is to certify that the project entitled NOTEPAD carried out by Amit Pathak (0715010021) and Amit Singh (0715010022) ,students of B.Tech 3rd year 5th semester in CETIILM-AHL, Greater Noida(U.P.) is here accepted and approved after proper evaluation as a creditable work submitted in the partial fulfillment of the requirement for awarding the degree of this approval, the undersigned do not necessarily endorse or approved any statement made, opinion expressed or conclusion therein, but approved the report for the purpose for which it is submitted.

(External Examiner) Date:

CERTIFICATE

This is to certify that the project entitled NOTEPAD done by Amit Pathak (0715010021) and Amit Singh(0715010022) is an authentic work carried out by them at project under my guidance. The matter embodied in this project work has not been submitted earlier for the award of any degree or diploma to the best of my knowledge and belief.

Prof. Krishna Kumar Singh CS Department CET-IILM-AHL Gr.Noida

ACKNOWLEDGEMENT
We are extremely pleased to present ourselves through this dissertation , after getting innumerable moments of anxiety and hard time with a never ending determination. The culmination of ones hard work is in acknowledging the omini presence of all those who made that final leap towards success a reality. First and foremost we would like to express our gratitude to our beloved Mr. Krishna Kumar Singh computer science department and appreciation towards our project guide without whose immeasurable priceless support, continuous encouragement and motivation , the culmination of this project would have been near possible.Last but not the least we would like to acknowledge the invaluable support lend by our department faculties right from the conceptualization of this project. Lastly , we have been fortunate to have handful of creative and insightful friends who have added much to development of the project.

INTRODUCTION
What is NOTEPAD? Note pad is a text editor whose objective is to provide the user a text plain where he can articulate or writes his notes on plain text. It is a software that provides the user the editor to type all their written material without any worry of spelling or grammatical mistakes that are automatically corrected.

1.1. ABSTRACT

The English language dictionary database is made and compiled in TC. This forms the back-end of our application. The text typed by the user is will be checked for any grammatical, logical and spelling errors by referencing each word typed to the words in the dictionary database. If any error is located then an appropriate error message shall be displayed indicating the presence of an error in the text.

1.2 PURPOSE It provides interactive pop-up menus for performing all the basic text related tasks. It is a menu driven application that performs text editing operations such as file, edit, search operations The application will also show suggestions along with the error message that will help the user to correct the mistakes he made in the document 1.2 Problem Statement The problem statements are written by a representative of the user specifying the functions of the system that it supposes to perform.

PROBLEM DEFINITION

The definition of our problem lies in providing user with a text space where he can edit his info and can check errors in that.

1.4 OVERVIEW

Notepad is mainly a text editor whose objective is to provide the user with a text editor where he can edit or do any operations with the given information. In notepad the spelling and the grammatical mistakes of English language are automatically founded. It is a software that provides the user the editor to type all their written material without any worry of spelling or grammatical mistakes that are automatically corrected by the spelling checker.

1.6 APPLICATIONS Normal text editor Editor for typing C, C++, Java programs A spelling checker as well as a grammatical error checker in an existing document of .text format. Normal text file compiler

2 .OVERALL DISCRIPTION
2.1 PRODUCT PERSPECTIVE Notepad is mainly a text editor whose objective is to provide a text page . It is a software that provides the user the editor to type all their written material without any worry of spelling or grammatical mistakes that are automatically corrected by the spelling checker. This project can be considered as a mini compiler and can be expended to form a whole compiler by including the phases of a compiler.

2.2 SCOPE OF DEVELOPMENT The notepad application designed by us as present is mainly used for creating ,editing and for checking the spelling errors in the document. At present we are focusing on only the spelling errors and the standard logical errors, the text editor provides a platform for text related files. the future of the project is that it can be modified for checking the grammatical errors of standard English dictionary. Modifications can be easily made for error checking as well correction of errors.

3 SPECIFIC REQUIREMENTS
3.1 USER Interface User while typing any word may make mistake which is eliminated by suggesting to the user appropriate word by highlighting that word with appropriate colour. 3.2 Project Interface Querying for 1.Dictionary word 2.Editing 3.Creating text file 4.Saving Text file

3.3 EXTERNAL INTERFACE REQUIREMENT 3.3.1 User Interface Requirements User interface is used to provide communication between users and system. Our product should have communication between them. Because, Notepad is a Text-based project and it should get input from users for processing. Firstly the system should ask to its users about what function to perform in text editor .Users will enter their desired choice and they will select an option for performing the required task. The system gets these inputs by using user interface.. After that, the system will give appropriate output for users via user interface. Finally users will see output at their screen according to their selected option. User interface elements should be easy to understand. Part of user interface should be well-organized on screen and the parts should be concatenated right. When users look at the interface, they understand which pane is used for which purpose. Each task of an interface should be specified clearly and users should use them correctly. The user interface should be easy to learn. When users use the user interface, they should know which element is used to which operations. We should teach using of the user interface to users simply. If it is hard to learn, then teaching will take long time and there will be an extra cost for teaching of product. The interface actions and elements should be consistent. When users press any button, required actions should be done by the system. The screen layout and color of the user interface should be appealing. When users look at the

screen, it will have a nice vision. Colors will be selected clearly, thus eyes of users wont be tired. 3.3.2 Hardware Interface Requirements Notepad is a text-based project. So any personal computer, which has an text-editor n java platform, is enough to use this system. 3.3.3 Software Interface Requirements jdk1.5 Net Beans software TC

FEASIBILITY STUDY
Feasibility study is to check the viability of the project under consideration. Theoretically various Types of feasibilities are conducted, but we have conducted three type of feasibilities explained as under. ECONOMIC FEASIBILITY With the manual system the operating cost of the system free of cost.The user can use this project anywhere for editing and performing all task related to text editor. TECHNICAL FEASIBILITY

This project requires following technical elements: o n jdk1.5 o n Net Beans software o n TC

OPERATIONAL FEASIBILITY This project is functional in all aspect depending upon how user uses this project.

ADVANCEMENTS In this version of notepad we had introduced a new concept of spell checker, which automatically checks the words weather they are correct or not .

FORMS Snapshots

Coding
//THE IMPORTED LIBRARIES import javax.swing.*; import javax.swing.undo.*; import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.event.*; import java.util.*; import javax.swing.text.*; import java.text.*; public class myedit extends JFrame implements ActionListener { public static myedit e; //DECLARATION OF ALL THE VARIABLES USED IN THIS APPLICATION JTextArea text = new JTextArea(0,0); JScrollPane scroll = new JScrollPane(text); JMenuBar mb=new JMenuBar(); JMenu FILE = new JMenu("File"); JMenu EDIT = new JMenu("Edit"); JMenu SEARCH = new JMenu("Search"); JMenu HELP = new JMenu("Help"); JMenuItem NEWFILE = new JMenuItem("New"); JMenuItem OPENFILE = new JMenuItem("Open..."); JMenuItem SAVEFILE = new JMenuItem("Save"); JMenuItem SAVEASFILE = new JMenuItem("Save As..."); JMenuItem EXITFILE = new JMenuItem("Exit"); JMenuItem CUTEDIT = new JMenuItem("Cut"); JMenuItem COPYEDIT = new JMenuItem("Copy"); JMenuItem PASTEDIT = new JMenuItem("Paste"); JMenuItem DELETEDIT = new JMenuItem("Delete"); JMenuItem SELECTEDIT = new JMenuItem("Select All"); JMenuItem TIMEDIT = new JMenuItem("Time/Date");

JCheckBoxMenuItem WORDEDIT = new JCheckBoxMenuItem("Word Wrap"); JMenuItem FONTEDIT = new JMenuItem("Set Font..."); JMenuItem FINDSEARCH = new JMenuItem("Find"); JMenuItem FINDNEXTSEARCH = new JMenuItem("Find Next"); JMenuItem ABOUTHELP = new JMenuItem("About"); JPopupMenu POPUP = new JPopupMenu(); JMenuItem CUTPOPUP = new JMenuItem("Cut"); JMenuItem COPYPOPUP = new JMenuItem("Copy"); JMenuItem PASTEPOPUP = new JMenuItem("Paste"); JMenuItem DELETEPOPUP = new JMenuItem("Delete"); JMenuItem SELECTPOPUP = new JMenuItem("Select All"); UndoManager undo = new UndoManager(); UndoAction undoAction = new UndoAction(); boolean opened = false; String wholeText,findString,filename = null; int ind = 0; //CLASS FOR HANDLING UNDO MENU OPTION OF EDIT AND POPUP MENU class UndoAction extends AbstractAction { public UndoAction() { super("Undo"); } public void actionPerformed(ActionEvent e) { try { undo.undo(); } catch (CannotUndoException ex) {

System.out.println("Unable tondo:"+ex); ex.printStackTrace(); } update(); } protected void update() { if(undo.canUndo()) { setEnabled(true); putValue("Undo", undo.getUndoPresentationName()); } else { setEnabled(false); putValue(Action.NAME, "Undo"); } } } //DEFAULT CONSTRUCTOR OF THE MYEDIT CLASS public myedit() { //SETING DEFAULT TITLE OF THE FRAME setTitle("Untitled"); //SETTING DEFAULT SIZE OF THE FRAME setSize(600,400); //MAKING THE FRAME VISIBLE setVisible(true); //SETTING WORD WRAP TO TRUE AS DEFAULT text.setLineWrap(true); //SETTING THE DEFAULT STATE OF WORDWRAP MENU OPTION IN EDIT MENU WORDEDIT.setState(true);

//SETTING THE LAYOUT OF THE FRAME getContentPane().setLayout(new BorderLayout()); //ADDS THE SCROLLPANE CONTAINING THE TEXTAREA TO THE CONTAINER getContentPane().add(scroll, BorderLayout.CENTER); //ADDING THE MAIN MENUBAR TO THE FRAME setJMenuBar(mb); //ADDING MENUS TO THE MAIN MENUBAR mb.add(FILE); mb.add(EDIT); mb.add(SEARCH); mb.add(HELP); //ADDING MENUITEMS TO THE FILE MENU FILE.add(NEWFILE); FILE.add(OPENFILE); FILE.add(SAVEFILE); FILE.add(SAVEASFILE); FILE.addSeparator(); FILE.add(EXITFILE); //ADDING MENUITEMS TO THE EDIT MENU EDIT.add(undoAction); EDIT.add(CUTEDIT); EDIT.add(COPYEDIT); EDIT.add(PASTEDIT); EDIT.add(DELETEDIT); EDIT.addSeparator(); EDIT.add(SELECTEDIT); EDIT.add(TIMEDIT); EDIT.addSeparator(); EDIT.add(WORDEDIT); EDIT.add(FONTEDIT); //ADDING MENUITEMS TO THE SEARCH MENU SEARCH.add(FINDSEARCH); SEARCH.add(FINDNEXTSEARCH);

//ADDING MENUITEM TO THE HELP MENU HELP.add(ABOUTHELP); //ADDING MENUITEMS TO THE POPUPMENU POPUP.add(undoAction); POPUP.addSeparator(); POPUP.add(CUTPOPUP); POPUP.add(COPYPOPUP); POPUP.add(PASTEPOPUP); POPUP.add(DELETEPOPUP); POPUP.addSeparator(); POPUP.add(SELECTPOPUP); //SETTING SHORTCUT KEYS OF MENUS IN THE MAIN MENUBAR FILE.setMnemonic(KeyEvent.VK_F); EDIT.setMnemonic(KeyEvent.VK_E); SEARCH.setMnemonic(KeyEvent.VK_S); HELP.setMnemonic(KeyEvent.VK_H); //SETTING SHORTCUT KEYS OF MENUITEMS IN THE FILE MENU NEWFILE.setMnemonic(KeyEvent.VK_N); OPENFILE.setMnemonic(KeyEvent.VK_O); SAVEFILE.setMnemonic(KeyEvent.VK_S); SAVEASFILE.setMnemonic(KeyEvent.VK_A); EXITFILE.setMnemonic(KeyEvent.VK_X); //SETTING SHORTCUT KEYS OF MENUITEMS IN THE EDIT MENU CUTEDIT.setMnemonic(KeyEvent.VK_T); COPYEDIT.setMnemonic(KeyEvent.VK_C); PASTEDIT.setMnemonic(KeyEvent.VK_P); DELETEDIT.setMnemonic(KeyEvent.VK_L); SELECTEDIT.setMnemonic(KeyEvent.VK_A); TIMEDIT.setMnemonic(KeyEvent.VK_D); WORDEDIT.setMnemonic(KeyEvent.VK_W); FONTEDIT.setMnemonic(KeyEvent.VK_F); //SETTING SHORTCUT KEYS OF MENUITEMS IN THE SEARCH MENU FINDSEARCH.setMnemonic(KeyEvent.VK_F); FINDNEXTSEARCH.setMnemonic(KeyEvent.VK_N); //SETTING SHORTCUT KEYS OF MENUITEM IN THE HELP MENU ABOUTHELP.setMnemonic(KeyEvent.VK_A);

//SETTING SHORTCUT KEYS OF MENUITEMS IN THE POPUPMENU CUTPOPUP.setMnemonic(KeyEvent.VK_T); COPYPOPUP.setMnemonic(KeyEvent.VK_C); PASTEPOPUP.setMnemonic(KeyEvent.VK_P); DELETEPOPUP.setMnemonic(KeyEvent.VK_D); SELECTPOPUP.setMnemonic(KeyEvent.VK_A); //SETTING ACCELERATOR KEYS OF SOME MENUITEMS IN THE EDIT MENU CUTEDIT.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,ActionEvent .CTRL_MASK)); COPYEDIT.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,ActionEve nt.CTRL_MASK)); PASTEDIT.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,ActionEven t.CTRL_MASK)); //ADDING LISTENERS TO THE MENUITEMS IN FILE MENU NEWFILE.addActionListener(this); OPENFILE.addActionListener(this); SAVEFILE.addActionListener(this); SAVEASFILE.addActionListener(this); EXITFILE.addActionListener(this); //ADDING LISTENERS TO THE MENUITEMS IN EDIT MENU text.getDocument().addUndoableEditListener(new UndoListener()); CUTEDIT.addActionListener(this); COPYEDIT.addActionListener(this); PASTEDIT.addActionListener(this); DELETEDIT.addActionListener(this); SELECTEDIT.addActionListener(this); TIMEDIT.addActionListener(this); WORDEDIT.addActionListener(this); FONTEDIT.addActionListener(this); //ADDING LISTENERS TO THE MENUITEMS IN SEARCH MENU FINDSEARCH.addActionListener(this); FINDNEXTSEARCH.addActionListener(this);

//ADDING LISTENERS TO THE MENUITEM IN HELP MENU ABOUTHELP.addActionListener(this); //ADDING LISTENERS TO THE MENUITEMS IN POPUPMENU CUTPOPUP.addActionListener(this); COPYPOPUP.addActionListener(this); PASTEPOPUP.addActionListener(this); DELETEPOPUP.addActionListener(this); SELECTPOPUP.addActionListener(this); //ADDING MOUSELISTENER TO RIGHT CLICK FOR THE POPUPLISTENER text.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { POPUP.show(e.getComponent(),e.getX(), e.getY()); } } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { POPUP.show(e.getComponent(),e.getX(), e.getY()); } } }); //ADDING WINDOWLISTENER TO HANDLE CLOSE WINDOW EVENT addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { int response = JOptionPane.showConfirmDialog(null, "Do you really want to quit?"); /*

System.out.println("Inside Window Listener"); switch (response) { case 0: { dispose(); break; } case 2: { //myedit x = new myedit(); System.out.println("Inside 2"); e=new myedit(); e.setVisible(true); break;} } System.out.println("response is :="+response); } } ); */

addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { exitApln(); } }); } //HANDLING ALL EVENTS OF THE TEXT EDITOR public void actionPerformed(ActionEvent e) { //ACTION FOR NEW MENU OPTION OF FILE MENU if (e.getSource()==NEWFILE) { newfile(); }

//ACTION FOR OPEN MENU OPTION OF FILE MENU if (e.getSource()==OPENFILE) { open(); } //ACTION FOR SAVE MENU OPTION OF FILE MENU if (e.getSource()==SAVEFILE) { save(); } //ACTION FOR SAVEAS MENU OPTION OF FILE MENU if (e.getSource()==SAVEASFILE) { opened=false; save(); } //ACTION FOR EXIT MENU OPTION OF FILE MENU if (e.getSource()==EXITFILE) { exitApln(); } //ACTION FOR CUT MENU OPTION OF EDIT MENU AND POPUPMENU if ((e.getSource()==CUTEDIT)||(e.getSource()==CUTPOPUP)) { text.cut(); } //ACTION FOR COPY MENU OPTION OF EDIT MENU AND POPUPMENU if ((e.getSource()==COPYEDIT)|| (e.getSource()==COPYPOPUP)) { text.copy(); } //ACTION FOR PASTE MENU OPTION OF EDIT MENU AND POPUPMENU

if ((e.getSource()==PASTEDIT)|| (e.getSource()==PASTEPOPUP)) { text.paste(); } //ACTION FOR DELETE MENU OPTION OF EDIT MENU AND POPUPMENU if ((e.getSource()==DELETEDIT)|| (e.getSource()==DELETEPOPUP)) { text.replaceSelection(null); } //ACTION FOR SELECTALL MENU OPTION OF EDIT MENU AND POPUPMENU if ((e.getSource()==SELECTEDIT)|| (e.getSource()==SELECTPOPUP)) { text.selectAll(); } //ACTION FOR TIME/DATE MENU OPTION OF EDIT MENU if (e.getSource()==TIMEDIT) { Date currDate; String dd; currDate = new java.util.Date(); dd=currDate.toString(); text.insert(dd,text.getCaretPosition()); } //ACTION FOR WORD WRAP MENU OPTION OF EDIT MENU if (e.getSource()==WORDEDIT) { if(WORDEDIT.isSelected()) text.setLineWrap(true); else text.setLineWrap(false); }

//ACTION FOR SET FONT MENU OPTION OF EDIT MENU if (e.getSource()==FONTEDIT) { fontDialogBox fontS = new fontDialogBox(); } //ACTION FOR FIND MENU OPTION OF SEARCH MENU if (e.getSource()==FINDSEARCH) { wholeText=text.getText(); findString =JOptionPane.showInputDialog(null, "Find What", "Find", JOptionPane.INFORMATION_MESSAGE); ind = wholeText.indexOf(findString,0); text.setCaretPosition(ind); text.setSelectionStart(ind); text.setSelectionEnd(ind+findString.length()); } //ACTION FOR FIND NEXT MENU OPTION OF SEARCH MENU if (e.getSource()==FINDNEXTSEARCH) { wholeText= text.getText(); findString = JOptionPane.showInputDialog(null, "Find What","Find Next", JOptionPane.INFORMATION_MESSAGE); ind = wholeText.indexOf(findString, text.getCaretPosition()); text.setCaretPosition(ind); text.setSelectionStart(ind); text.setSelectionEnd(ind+findString.length()); } //ACTION FOR ABOUT MENU OPTION OF HELP MENU if (e.getSource()==ABOUTHELP) { JOptionPane.showMessageDialog(null, "This is a simple Text Editor application built using Java.", "About Editor", JOptionPane.INFORMATION_MESSAGE);

} } //ACTION FOR NEW MENU OPTION OF FILE MENU public void newfile() { if(!text.getText().equals("")) { opened=false; int confirm = JOptionPane.showConfirmDialog(null, "Text in the Untitled file has changed. \n Do you want to save the changes?", "New File", JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MES SAGE); if( confirm == JOptionPane.YES_OPTION ) { save(); text.setText(null); } else if( confirm == JOptionPane.NO_OPTION ) { text.setText(null); } } } //ACTION FOR OPEN MENU OPTION OF FILE MENU public void open() { text.setText(null); JFileChooser ch = new JFileChooser(); ch.setCurrentDirectory(new File(".")); ch.setFileFilter(new javax.swing.filechooser.FileFilter() { public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith(".java");

} public String getDescription() { return "Java files"; } }); int result = ch.showOpenDialog(new JPanel()); if(result == JFileChooser.APPROVE_OPTION) { filename = String.valueOf(ch.getSelectedFile()); setTitle(filename); opened=true; FileReader fr; BufferedReader br; try { fr=new FileReader (filename); br=new BufferedReader(fr); String s; while((s=br.readLine())!=null) { text.append(s); text.append("\n"); } fr.close(); } catch(FileNotFoundException ex) { JOptionPane.showMessageDialog(this, "Requested file not found", "Error Dialog box", JOptionPane.ERROR_MESSAGE);} catch(Exception ex) {System.out.println(ex);} } } //ACTION FOR SAVE MENU OPTION OF FILE MENU public void save() {

if(opened==true) { try { FileWriter f1 = new FileWriter(filename); f1.write(text.getText()); f1.close(); opened = true; } catch(FileNotFoundException ex) { JOptionPane.showMessageDialog(this, "Requested file not found", "Error Dialog box", JOptionPane.ERROR_MESSAGE);} catch(IOException ioe){ioe.printStackTrace();} } else { JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(".")); int result = fc.showSaveDialog(new JPanel()); if(result == JFileChooser.APPROVE_OPTION) { filename = String.valueOf(fc.getSelectedFile()); setTitle(filename); try { FileWriter f1 = new FileWriter(filename); f1.write(text.getText()); f1.close(); opened = true; } catch(FileNotFoundException ex) { JOptionPane.showMessageDialog(this, "Requested file not found", "Error Dialog box", JOptionPane.ERROR_MESSAGE);} catch(IOException ioe){ioe.printStackTrace();} }

} } //ACTION FOR EXIT MENU OPTION OF FILE MENU AND CLOSE WINDOW BUTTON public void exitApln() { if(!text.getText().equals("")) { int confirm = JOptionPane.showConfirmDialog(null, "Text in the file has changed. \n Do you want to save the changes?", "Exit", JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MES SAGE); if( confirm == JOptionPane.YES_OPTION ) { save(); dispose(); System.exit(0); } else if( confirm == JOptionPane.CANCEL_OPTION ) { e=new myedit(); String s= text.getText(); e.setVisible(true); e.text.setText(s); } else if( confirm == JOptionPane.NO_OPTION ) { dispose(); System.exit(0); } } else { System.exit(0); } }

//CLASS FOR UNDOLISTENER class UndoListener implements UndoableEditListener { public void undoableEditHappened(UndoableEditEvent e) { undo.addEdit(e.getEdit()); undoAction.update(); } } //CLASS FOR BUILDING AND DISPLAYING FONT DIALOG BOX class fontDialogBox extends JFrame implements ActionListener { //DECLARATION OF ALL VARIABLES USED IN fontDialogBox CLASS String availableFontString[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNa mes(); JList fontList = new JList(availableFontString); JLabel fontLabel = new JLabel("Font"); JTextField valueFont=new JTextField("Arial"); JScrollPane fontPane = new JScrollPane(fontList); String fontStyleString[] = {"Normal","Bold","Italic","Bold Italic"}; JList styleList = new JList(fontStyleString); JLabel styleLabel = new JLabel("Style"); int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED; JScrollPane stylePane = new JScrollPane(styleList,v,h); JTextField valueStyle=new JTextField("Normal"); String fontSizeString[] = {"8","10","12","14","16","18","20","22","24","28"}; JList sizeList = new JList(fontSizeString); JLabel sizeLabel = new JLabel("Font size"); JScrollPane sizePane = new JScrollPane(sizeList); JTextField valueSize=new JTextField("12");

JButton okButton = new JButton("OK"); JButton cancelButton = new JButton("Cancel"); JLabel sampleLabel = new JLabel("Sample:"); JTextField sample = new JTextField(" AaBbCc"); Font selectedFont; //DEFAULT CONSTRUCTOR OF fontDialogBox CLASS public fontDialogBox() { setSize(500,300); setTitle("Font"); setVisible(true); sample.setEditable(false); getContentPane().setLayout(null); fontLabel.setBounds(10,10,170,20); valueFont.setBounds(10,35,170,20); fontPane.setBounds(10,60,170,150); styleLabel.setBounds(200,10,100,20); valueStyle.setBounds(200,35,100,20); stylePane.setBounds(200,60,100,150); sizeLabel.setBounds(320,10,50,20); valueSize.setBounds(320,35,50,20); sizePane.setBounds(320,60,50,150); okButton.setBounds(400,35,80,20); cancelButton.setBounds(400,60,80,20); sampleLabel.setBounds(150,235,50,30); sample.setBounds(200,235,100,30); getContentPane().add(fontLabel); getContentPane().add(fontPane); getContentPane().add(valueFont);

getContentPane().add(styleLabel); getContentPane().add(stylePane); getContentPane().add(valueStyle); getContentPane().add(sizeLabel); getContentPane().add(sizePane); getContentPane().add(valueSize); getContentPane().add(okButton); getContentPane().add(cancelButton); getContentPane().add(sampleLabel); getContentPane().add(sample); okButton.addActionListener(this); cancelButton.addActionListener(this); fontList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { valueFont.setText(fontList.getSelectedValue().toString()); selectedFont = new Font(valueFont.getText(),styleList.getSelectedIndex(),Integer.parseInt(valueSize.g etText())); sample.setFont(selectedFont); } } }); styleList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting())

{ valueStyle.setText(styleList.getSelectedValue().toString()); selectedFont = new Font(valueFont.getText(),styleList.getSelectedIndex(),Integer.parseInt(valueSize.g etText())); sample.setFont(selectedFont); } } }); sizeList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { valueSize.setText(sizeList.getSelectedValue().toString()); selectedFont = new Font(valueFont.getText(),styleList.getSelectedIndex(),Integer.parseInt(valueSize.g etText())); sample.setFont(selectedFont); } } }); } //END OF DEFAULT CONSTRUCTOR OF fontdialogBox CLASS public void actionPerformed(ActionEvent ae) { if(ae.getSource()==okButton) { selectedFont = new Font(valueFont.getText(),styleList.getSelectedIndex(),Integer.parseInt(valueSize.g etText())); text.setFont(selectedFont); setVisible(false);

} if(ae.getSource()==cancelButton) { setVisible(false); } } } // END OF fontDialogBox CLASS //MAIN FUNCTION OF MYEDIT CLASS public static void main(String args[]) { e= new myedit(); } } //END OF MYEDIT CLASS

NOTEPAD PROJECT

UNDER THE GUIDANCE OF: Mr. Krishna Kumar Singh

SUBMITTED BY: Amit Singh (0715010022)

CERTIFICATE OF PROJECT COMPLETION

This is to certify that the project entitled NOTEPAD carried out by Amit Pathak (0715010021) student of B.Tech 3rd year 5th semester in CET-IILM-AHL, Greater Noida(U.P.) is here accepted and approved after proper evaluation as a creditable work submitted in the partial fulfillment of the requirement for awarding the degree of this approval, the undersigned do not necessarily endorse or approved any statement made, opinion expressed or conclusion therein, but approved the report for the purpose for which it is submitted.

(External Examiner) Date:

CERTIFICATE

This is to certify that the project entitled NOTEPAD done by Amit Pathak (0715010021) is an authentic work carried out by them at project under my guidance. The matter embodied in this project work has not been submitted earlier for the award of any degree or diploma to the best of my knowledge and belief.

Prof. Krishna Kumar Singh CS Department CET-IILM-AHL Gr.Noida

CERTIFICATE OF PROJECT COMPLETION

This is to certify that the project entitled NOTEPAD carried out by Amit Singh (0715010022) , student of B.Tech 3rd year 5th semester in CET-IILM-AHL, Greater Noida(U.P.) is here accepted and approved after proper evaluation as a creditable work submitted in the partial fulfillment of the requirement for awarding the degree of this approval, the undersigned do not necessarily endorse or approved any statement made, opinion expressed or conclusion therein, but approved the report for the purpose for which it is submitted.

(External Examiner) Date:

CERTIFICATE

This is to certify that the project entitled NOTEPAD done by Amit Singh(0715010022) is an authentic work carried out by them at project under my guidance. The matter embodied in this project work has not been submitted earlier for the award of any degree or diploma to the best of my knowledge and belief.

Prof. Krishna Kumar Singh CS Department CET-IILM-AHL Gr . Noida

You might also like