

{"id":98180,"date":"2021-07-12T09:00:09","date_gmt":"2021-07-12T03:30:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=98180"},"modified":"2026-06-01T14:28:28","modified_gmt":"2026-06-01T08:58:28","slug":"create-notepad-in-java","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/","title":{"rendered":"How to Create Notepad in Java"},"content":{"rendered":"<p>Notepad is a simple software that is used by users on a daily basis. Users can use a notepad for noting down the important notes, to-dos, writing codes, etc. Some users use notepads for diary writing, story writing, etc.<\/p>\n<h3>About Notepad Project<\/h3>\n<p>We will develop following functionalities in Java Notepad<\/p>\n<ul>\n<li>Users can create new text files and note down the notes.<\/li>\n<li>Users can open the existing text file.<\/li>\n<li>Users can save the text file on their machine.<\/li>\n<li>Users can print the text file via their printer.<\/li>\n<li>Users can also copy, paste, cut, selectall text in the notepad.<\/li>\n<li>Users can also format their text on different font-styles, font-sizes, etc<\/li>\n<\/ul>\n<h3>Project Prerequisites:<\/h3>\n<ul>\n<li>IDE Used: NetBeans 11.2 (You can use Eclipse or any other Java editor)<\/li>\n<li>Java should be installed on the machine.<\/li>\n<li>To build a notepad text editor using java we require basic knowledge of java and file operations.<\/li>\n<li>Java provides by default packages such as Abstract Window Toolkit (AWT) &amp; Swing packages to create user interface(UI) for desktop applications.<\/li>\n<\/ul>\n<h3>Download Notepad Java Code<\/h3>\n<p>Please download the source code of Java Notepad: <a href=\"https:\/\/drive.google.com\/file\/d\/1HASbe-Vvasp__ysfaZ9857w_LN9oIHFT\/view?usp=drive_link\"><strong>Notepad Java Project Code<\/strong><\/a><\/p>\n<h3>Steps to Create Notepad &#8211; Text Editor Java Project<\/h3>\n<p>These are the step to build Notepad Text Editor using Java:<\/p>\n<ol>\n<li>Import packages<\/li>\n<li>Initialize User Interface<\/li>\n<li>Adding Actions to buttons<\/li>\n<li>Performing Actions of User<\/li>\n<\/ol>\n<h4>1) Import packages<\/h4>\n<p>In this step, we will import File, AWT &amp; Swing required packages<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import java.io.*;\r\nimport javax.swing.*;\r\nimport java.awt.*;\r\nimport java.awt.event.*;\r\nimport javax.swing.filechooser.FileNameExtensionFilter;\r\n<\/pre>\n<h4>2) Initialize User Interface<\/h4>\n<p>In this very initial step, we will create the basic user interface for our Notepad Desktop Java Application. We will create a menu such as File, Edit, Format &amp; Sub-Menu in that such as New File, Open File, Save File, Exit, Select All Text, Cut , Copy, Paste, Change Font Family, Change Font Style, Change Font Size, etc.<\/p>\n<p><strong>Functions Definitions:<\/strong><\/p>\n<p><strong>a)<\/strong> <strong>setLayout(layout):<\/strong> This function will define the layout of the frame, window, pane, in which all the components are arranged.<br \/>\n<strong>b) setText(\u201cyour text\u201d):<\/strong> This function will set the title or the text on the label, button,etc.<br \/>\n<strong>c) setVisible(true):<\/strong> This function will make the frame or window visible to the user. By default, it is false.<br \/>\n<strong>d) setSize(int<\/strong> <strong>width, int height):<\/strong> This function takes two parameters such as height and width. It is used to define the size of frame\/window, panel, etc.<br \/>\n<strong>e) add(obj):<\/strong> This function is used to add the components in a sequential manner to the frame or panel.<br \/>\n<strong>f) setAccelerator(KeyStroke<\/strong> keyStroke): This function sets the short-cuts keyboard for the respective menu item.<br \/>\n<strong>g) setSelectionMode(MODE):<\/strong> This function sets the selection mode of the list, it can be single or multiple.<br \/>\n<strong>h) setFont(Font):<\/strong> This function sets the font family, font style, font size of the textarea and textfield.<br \/>\n<strong>i) setLineWrap(true):<\/strong> This function sets the line-wrapping policy of the text area. By default, it is false.<br \/>\n<strong>j) setWrapStyleWord(true):<\/strong> This function sets the word-wrapping policy of the text area. By default, it is false.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public void initUI() {\r\n    detailsOfFile = new JLabel();\r\n\r\n    bottomPanel = new JPanel();\r\n\r\n    \/\/Creating Menubar\r\n    menuBar = new JMenuBar();\r\n\r\n    \/\/Creating Menu \"File\"\r\n    file = new JMenu(\"File\");\r\n\r\n    \/\/Creating MenuItem \"New\"\r\n    newdoc = new JMenuItem(\"New\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + N\" for \"New\" Menu Item\r\n    newdoc.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Open\" in notepad\r\n    open = new JMenuItem(\"Open\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + O\" for \"Open\" Menu Item\r\n    open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Save\"\r\n    save = new JMenuItem(\"Save\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + S\" for \"Save\" Menu Item\r\n    save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Print\" in text editor\r\n    print = new JMenuItem(\"Print\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + P\" for \"Print\" Menu Item\r\n    print.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Exit\"\r\n    exit = new JMenuItem(\"Exit\");\r\n\r\n    \/\/Assigning shortcut \"ESC\" for \"Exit\" Menu Item\r\n    exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));\r\n\r\n    \/\/Creating Menu \"Edit\" in Notepad\r\n    edit = new JMenu(\"Edit\");\r\n\r\n    \/\/Creating MenuItem \"Copy\" in java notepad\r\n    copy = new JMenuItem(\"Copy\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + C\" for \"Copy\" Menu Item\r\n    copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Paste\" in Java Notepad\r\n    paste = new JMenuItem(\"Paste\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + V\" for \"Paste\" Menu Item\r\n    paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Cut\"\r\n    cut = new JMenuItem(\"Cut\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + X\" for \"Cut\" Menu Item\r\n    cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating MenuItem \"Select All\"\r\n    selectall = new JMenuItem(\"Select All\");\r\n\r\n    \/\/Assigning shortcut \"Ctrl + A\" for \"Select All\" Menu Item\r\n    selectall.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));\r\n\r\n    \/\/Creating Menu \"Format\"\r\n    format = new JMenu(\"Format\");\r\n\r\n    \/\/Creating MenuItem \"Font Family\"\r\n    fontfamily = new JMenuItem(\"Font Family\");\r\n\r\n    \/\/Creating MenuItem \"Font Style\"\r\n    fontstyle = new JMenuItem(\"Font Style\");\r\n\r\n    \/\/Creating MenuItem \"Font Size\" in Java Text Editor\r\n    fontsize = new JMenuItem(\"Font Size\");\r\n\r\n    \/\/Creating List of Font Family and assigning the list values\r\n    familylist = new JList(fontFamilyvalue);\r\n\r\n    \/\/Creating List of Font Styles and assigning the list values\r\n    stylelist = new JList(stylevalues);\r\n\r\n    \/\/Creating List of Font Size and assigning the list values\r\n    sizelist = new JList(sizevalue);\r\n\r\n    \/\/Allowing user to select only one option\r\n    familylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r\n    sizelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r\n    stylelist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r\n\r\n    \/\/TextArea \/ Editor of Notepad\r\n    area = new JTextArea();\r\n\r\n    \/\/Default font will be sam_serif and default font style will be plain and default style will be 20. \r\n    area.setFont(new Font(\"SAN_SERIF\", Font.PLAIN, 20));\r\n\r\n    \/\/Sets the line-wrapping policy of the text area\r\n    area.setLineWrap(true);\r\n\r\n    \/\/Sets the word-wrapping policy of the text area\r\n    area.setWrapStyleWord(true);\r\n\r\n    \/\/Creating Scrollbars around textarea\r\n    scpane = new JScrollPane(area);\r\n\r\n    \/\/Creating border for scrollpane\r\n    scpane.setBorder(BorderFactory.createEmptyBorder());\r\n\r\n    \/\/Adding menubar in frame\r\n    f.setJMenuBar(menuBar);\r\n\r\n    \/\/Adding all menus in menubars\r\n    menuBar.add(file);\r\n    menuBar.add(edit);\r\n    menuBar.add(format);\r\n\r\n    file.add(newdoc);\r\n    file.add(open);\r\n    file.add(save);\r\n    file.add(print);\r\n    file.add(exit);\r\n\r\n    edit.add(copy);\r\n    edit.add(paste);\r\n    edit.add(cut);\r\n    edit.add(selectall);\r\n\r\n    format.add(fontfamily);\r\n    format.add(fontstyle);\r\n    format.add(fontsize);\r\n\r\n    bottomPanel.add(detailsOfFile);\r\n\r\n    \/\/Setting up the size of frame\r\n    f.setSize(980, 480);\r\n\r\n    \/\/Setting up the layout of frame\r\n    f.setLayout(new BorderLayout());\r\n\r\n    \/\/Adding panels in frame\r\n    f.add(scpane, BorderLayout.CENTER);\r\n    f.add(bottomPanel, BorderLayout.SOUTH);\r\n    \/\/Setting Frame visible to user\r\n    f.setVisible(true);\r\n}\r\n<\/pre>\n<h4>3) Adding Actions to buttons:<\/h4>\n<p>In this step, we basically assign the actions to our buttons.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public void addActionEvents() {\r\n        \/\/registering action listener to buttons\r\n        newdoc.addActionListener(this);\r\n        save.addActionListener(this);\r\n        print.addActionListener(this);\r\n        exit.addActionListener(this);\r\n        copy.addActionListener(this);\r\n        paste.addActionListener(this);\r\n        cut.addActionListener(this);\r\n        selectall.addActionListener(this);\r\n        open.addActionListener(this);\r\n        fontfamily.addActionListener(this);\r\n        fontsize.addActionListener(this);\r\n        fontstyle.addActionListener(this);\r\n\r\n    }<\/pre>\n<h4>4) Performing Actions of User:<\/h4>\n<p>In this step, we will specify what will happen when a particular button is clicked or any shortcut is pressed.<\/p>\n<ul>\n<li>If a user clicks on the New button or presses key Ctrl +N then a new Text File will be created for the user.<\/li>\n<li>If a user clicks on the Open button or presses key Ctrl +O it will open the existing user selected file using java notepad application.<\/li>\n<li>If a user clicks on the Save button or presses Ctrl +S it will allow the user to save the file on their machine.<\/li>\n<li>If a user clicks on the Print button or presses Ctrl + P it will allow the user to print the file on their machine.<\/li>\n<li>If a user clicks on the Exit button or presses ESC it will close the notepad application.<\/li>\n<li>If a user clicks on the Copy button or presses Ctrl + C it will allow the user to copy text from the editor.<\/li>\n<li>If a user clicks on the Paste button or presses Ctrl + V it will allow the user to paste text from the java text editor.<\/li>\n<li>If a user clicks on the Cut button or presses Ctrl + X it will allow the user to cut that text from the editor.<\/li>\n<li>If a user clicks on the Select All button or presses Ctrl + A it will allow the user to select all text from the java text editor.<\/li>\n<li>If a user clicks on the Font Family button it will allow the user to format the font family of the text.<\/li>\n<li>If a user clicks on the Font Style button it will allow the user to format the font style of the text.<\/li>\n<li>If a user clicks on the Font Size button it will allow the user to format the font size of the text.<\/li>\n<li>If a user types any text on the editor, using keylistener we calculate the length of the text and line count of the text in the notepad.<\/li>\n<\/ul>\n<p><strong>Function Definitions:<\/strong><\/p>\n<p><strong>a) setText(\u201cyour text\u201d):<\/strong> This function will set the text of the text area.<br \/>\n<strong>b) addChoosableFileFilter(filter):<\/strong> This function will allow specific extensions of file to be selected provided by filter.<br \/>\n<strong>c) read():<\/strong> This function will read text from the file.<br \/>\n<strong>d) write():<\/strong> This function will write text to the file in notepad.<br \/>\n<strong>e) dispose():<\/strong> This function will destroy \/ close the frame \/ window.<br \/>\n<strong>f) print():<\/strong> This function will open the printer dialog box for printing the file in java notepad application.<br \/>\n<strong>g) getSelectedText():<\/strong> This function will get the selected text from the user.<br \/>\n<strong>h) selectAll():<\/strong> This function will select all the text from the text area in java notepad application.<br \/>\n<strong>i) getSelectionStart():<\/strong> This function will return the start position of the text.<br \/>\n<strong>j) getSelectionEnd():<\/strong> This function will return the last position of the text.<br \/>\n<strong>k) replaceRange(&#8220;text&#8221;,<\/strong> startPosition, lastPosition): This function will replace the text between the start position of text and the last position of text. This function takes three parameters: text, start position of text and end position of text.<br \/>\n<strong>l) getCaretPosition():<\/strong> This function will return the selected text&#8217;s start position.<br \/>\n<strong>m) insert(text,<\/strong> specifiedPosition): This function will insert the text from the specified position.<br \/>\n<strong>n) setFont(Font):<\/strong> This function sets the font family, font style, font size of the textarea and textfield.<br \/>\n<strong>o) length():<\/strong> This function will return the length of the text of the text area or text field.<br \/>\n<strong>p) getLineCount():<\/strong> This function will return the line count of the text of the text area or text field.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">public void actionPerformed(ActionEvent ae) {\r\n        \/\/if new option is chosen\r\n        if (ae.getActionCommand().equals(\"New\")) {\r\n            \/\/Setting Text as empty by default\r\n            area.setText(\"\");\r\n        } \/\/if open option is chosen\r\n        else if (ae.getActionCommand().equals(\"Open\")) {\r\n            \/\/Setting current by default directory \"C\" folder\r\n            JFileChooser chooser = new JFileChooser(\"C:\/\");\r\n            chooser.setAcceptAllFileFilterUsed(false);\r\n            \/\/Allowing only text (.txt) files extension to open\r\n            FileNameExtensionFilter restrict = new FileNameExtensionFilter(\"Only .txt files\", \"txt\");\r\n            chooser.addChoosableFileFilter(restrict);\r\n\r\n            int result = chooser.showOpenDialog(f);\r\n            if (result == JFileChooser.APPROVE_OPTION) {\r\n                File file = chooser.getSelectedFile();\r\n                try {\r\n                    \/\/Reading the file\r\n                    FileReader reader = new FileReader(file);\r\n                    BufferedReader br = new BufferedReader(reader);\r\n                    area.read(br, null);\r\n                    \/\/Closing the file after reading\r\n                    \/\/Clearing the memory\r\n                    br.close();\r\n                    area.requestFocus();\r\n                } catch (Exception e) {\r\n                    System.out.print(e);\r\n                }\r\n            }\r\n        } \/\/if save option is chosen in java notepad application\r\n        else if (ae.getActionCommand().equals(\"Save\")) {\r\n            final JFileChooser SaveAs = new JFileChooser();\r\n            SaveAs.setApproveButtonText(\"Save\");\r\n            \/\/Opening the dialog and asking from user where to save the file.\r\n            int actionDialog = SaveAs.showOpenDialog(f);\r\n            if (actionDialog != JFileChooser.APPROVE_OPTION) {\r\n                return;\r\n            }\r\n            File fileName = new File(SaveAs.getSelectedFile() + \".txt\");\r\n            BufferedWriter outFile = null;\r\n            try {\r\n                outFile = new BufferedWriter(new FileWriter(fileName));\r\n                area.write(outFile);\r\n            } catch (IOException e) {\r\n                e.printStackTrace();\r\n            }\r\n        } \/\/if print option is chosen\r\n        else if (ae.getActionCommand().equals(\"Print\")) {\r\n            try {\r\n                \/\/printer dialog will open\r\n                area.print();\r\n            } catch (Exception e) {\r\n            }\r\n        } \/\/if exit option is chosen\r\n        else if (ae.getActionCommand().equals(\"Exit\")) {\r\n            \/\/Destroying\/Closing the frame\/window\r\n            f.dispose();\r\n        } \/\/if copy option is chosen\r\n        else if (ae.getActionCommand().equals(\"Copy\")) {\r\n            \/\/Getting Selected Selected Text\r\n            text = area.getSelectedText();\r\n        } \/\/if paste option is chosen\r\n        else if (ae.getActionCommand().equals(\"Paste\")) {\r\n            area.insert(text, area.getCaretPosition());\r\n        } \/\/if cut option is chosen\r\n        else if (ae.getActionCommand().equals(\"Cut\")) {\r\n            text = area.getSelectedText();\r\n            area.replaceRange(\"\", area.getSelectionStart(), area.getSelectionEnd());\r\n        } \/\/if select all option is chosen\r\n        else if (ae.getActionCommand().equals(\"Select All\")) {\r\n            \/\/Selecting all text\r\n            area.selectAll();\r\n        } \/\/if font family change option is chosen in java text editor\r\n        else if (ae.getActionCommand().equals(\"Font Family\")) {\r\n            \/\/Setting up Font Family\r\n            JOptionPane.showConfirmDialog(null, fontFamilyList, \"Choose Font Family\", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);\r\n            fontFamily = String.valueOf(fontFamilyList.getSelectedValue());\r\n            newFont = new Font(fontFamily, fstyle, fsize);\r\n            area.setFont(newFont);\r\n\r\n        } \/\/if font style change option is chosen\r\n        else if (ae.getActionCommand().equals(\"Font Style\")) {\r\n            \/\/Setting up Font Style\r\n            JOptionPane.showConfirmDialog(null, fontStyleList, \"Choose Font Style\", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);\r\n            fstyle = stylevalue[fontStyleList.getSelectedIndex()];\r\n            newFont = new Font(fontFamily, fstyle, fsize);\r\n            area.setFont(newFont);\r\n\r\n        } \/\/if font size change option is chosen\r\n        else if (ae.getActionCommand().equals(\"Font Size\")) {\r\n            \/\/Setting up Font Size\r\n            JOptionPane.showConfirmDialog(null, fontSizeList, \"Choose Font Size\", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);\r\n            fontSize = String.valueOf(fontSizeList.getSelectedValue());\r\n            fsize = Integer.parseInt(fontSize);\r\n            newFont = new Font(fontFamily, fstyle, fsize);\r\n            area.setFont(newFont);\r\n\r\n        }\r\n    }\r\n\r\n public void keyTyped(KeyEvent ke) {\r\n        \/\/Calculating length and count of words\r\n        cl = area.getText().length();\r\n        linecount = area.getLineCount();\r\n        detailsOfFile.setText(\"Length: \" + cl + \" Line: \" + linecount);\r\n    }\r\n<\/pre>\n<h3>Java Notepad \/ Text Editor Output<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-98182\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output.gif\" alt=\"java notepad output\" width=\"1920\" height=\"1008\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output.gif 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output-768x403.gif 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output-1536x806.gif 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output-720x378.gif 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output-520x273.gif 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/java-notepad-output-320x168.gif 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Yayyy! We have finally built our Notepad &#8211; Text Editor in java. Now we can create, edit our text files on our machine: desktop \/ laptop.<\/p>\n<p>Also, we can now important notes, to do, maintain a diary, we can also write stories, etc. From this section, we have learned how to do file operations, and how to create user interface components such as frame, panels, buttons, labels, filechooser, etc with the help of AWT and Swing packages.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2626,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1HASbe-Vvasp__ysfaZ9857w_LN9oIHFT\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601090023\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1HASbe-Vvasp__ysfaZ9857w_LN9oIHFT\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 08:44:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-06 15:23:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-11 04:39:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-15 12:14:20&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-15 12:14:20&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Notepad is a simple software that is used by users on a daily basis. Users can use a notepad for noting down the important notes, to-dos, writing codes, etc. Some users use notepads for&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":98181,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[22420,24755,24757,24756],"class_list":["post-98180","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-core-java-projects","tag-java-notepad","tag-java-notepad-project","tag-java-text-editor"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create Notepad in Java - DataFlair<\/title>\n<meta name=\"description\" content=\"Create Notepad - Text Editor in Java using AWT &amp; Swing. Users can create, edit, format, save files using the java notepad application\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Notepad in Java - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Create Notepad - Text Editor in Java using AWT &amp; Swing. Users can create, edit, format, save files using the java notepad application\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-12T03:30:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T08:58:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/create-notepad-java-project.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Notepad in Java - DataFlair","description":"Create Notepad - Text Editor in Java using AWT & Swing. Users can create, edit, format, save files using the java notepad application","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Notepad in Java - DataFlair","og_description":"Create Notepad - Text Editor in Java using AWT & Swing. Users can create, edit, format, save files using the java notepad application","og_url":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-07-12T03:30:09+00:00","article_modified_time":"2026-06-01T08:58:28+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/create-notepad-java-project.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"How to Create Notepad in Java","datePublished":"2021-07-12T03:30:09+00:00","dateModified":"2026-06-01T08:58:28+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/"},"wordCount":1177,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/create-notepad-java-project.jpg","keywords":["core java projects","java notepad","java notepad project","java text editor"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/","url":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/","name":"How to Create Notepad in Java - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/create-notepad-java-project.jpg","datePublished":"2021-07-12T03:30:09+00:00","dateModified":"2026-06-01T08:58:28+00:00","description":"Create Notepad - Text Editor in Java using AWT & Swing. Users can create, edit, format, save files using the java notepad application","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/create-notepad-java-project.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/create-notepad-java-project.jpg","width":1200,"height":628,"caption":"create notepad java project"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/create-notepad-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Java Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/java\/"},{"@type":"ListItem","position":3,"name":"How to Create Notepad in Java"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/98180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=98180"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/98180\/revisions"}],"predecessor-version":[{"id":148713,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/98180\/revisions\/148713"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/98181"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=98180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=98180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=98180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}